The type() builtin according to python docs, returns a "type object".
And in this module is bunch of what I assume are "type objects". Is this correct?
And type(), aside from being used in as an alternative to a class statement to create a new type, really just returns the object class, doesn't it?
>>> import types
>>> a = type(1)
>>> b = (1).__class__
>>> c = int
>>> d = types.IntType
>>> a is b is c is d
If type() didn't exist would it be much more of a matter than the following?:
What is the purpose of type()?
What exactly is a "type object"? Is it a "class"?
What is the purpose of the types module?
I understand the purpose of isinstance and why it's recommended over something like (type(1) is int). Because isinstance will also return True if the object is an instance of a subclass.
>>> class xint(int):
>>> x = xint()
>>> type(x) is int
>>> isinstance(x, int)