Short version of the question: Why is the type of an instance of a generator not the generator function that created the instance? That is, if we have a generator, say `def G(): yield 1` and `g` is a generator instance created by `G`, that is `g = G()`, then why is `type(g) is G` false? 

Details:

I recently asked a question on how to determine what type of generator a given generator object is. (See [In Python, is there any way to test a generator object to find out which generator created it?](https://stackoverflow.com/q/22389566/1228896).) The answer ended up requiring the use of `__name__`. However, this still left a question unanswered for me: why are generators not types in Python? 

All the code below is with Python 3.3 in mind, but I believe most of it is applicable to older versions of Python (at least 2.7 anyway) and newer versions, namely 3.4.

Let's look at a very simple example of an iterator implemented as a class first:

```
class C(object):
    def __iter__(self):
        return self

    def __next__(self):
        return 1

c = C()
print(next(c))       # 1
print(type(c))       # <class '__main__.C'>
print(type(c) is C)  # True

```

Functionally, the class above is the same as the generator given below. (Of course, we are missing `throw`, `send` and `close`, and there are other subtle differences, but I believe they are not that relevant to the question at hand.)

```
def G():
    while True:
        yield 1

g = G()
print(next(g))       # 1
print(type(g))       # <class 'generator'>
print(type(g) is G)  # False

```

But as you can see, the types of objects created by the generator defined using `def` and `yield` and an iterator created using a class are handled completely differently. All generator instances are given the generic type `generator`. This, to me, is analogous to all objects created by classes being given a generic type, say `object`, which of course is not the case.

Python is overall is a very consistent and logical language. In particular, Python's treatment of types is very consistent: the "creator" of an object becomes its type. This works quite nicely even with metaclasses:

```
class M(type):
    def __new__(cls, *args):
        return super().__new__(cls, *args)

class C(metaclass=M):
    pass

c = C()

print(type(c) is C)        # True
print(type(C) is M)        # True
print(type(M) is type)     # True
print(type(type) is type)  # True

```

You can see here that `type(c)` is `C` because `c` is created by `C`, and `type(C)` is `M` because the class object `C` was created by the metaclass `M`, and finally `M` itself is a class object which is created by the metaclass `type`. We even have `type(type)` is `type`, which, being a self-reference, provides a root for the type hierarchy.

However, with generators, I feel like this consistency is broken. In the above, when we have `g = G()`, the object `g` is in fact created by `G`. Shouldn't it have its type set to be equal to `G`? Or is there a deeper reason behind the choice of a generic type for all generator instances that I am failing to see?