how can both work?
they can't both be the superclass of each other right? or is it some
sort of mutually recursive definition?
>>> help(object)
Help on class object in module __builtin__:
class object
| The most base type
>>> help(type)
Help on class type in module __builtin__:
class type(object)
| type(object) -> the object's type
| type(name, bases, dict) -> a new type
type inherits object.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy
some sort, yes:
>
>
>>>> help(object)
> Help on class object in module __builtin__:
>
> class object
> | The most base type
>
>>>> help(type)
> Help on class type in module __builtin__:
>
> class type(object)
> | type(object) -> the object's type
> | type(name, bases, dict) -> a new type
You forgot:
>>> type(object)
<type 'type'>
>>>
>>> type(type)
<type 'type'>
>>>
<apply-only to="new-style classes">
As you can see, object is both the superclass *and* an instance of type,
and type is an instance of itself.
This kind of situation is common in OOPLs having metaclasses and a
unique common base class.
A class is an object, so it have to be an instance of a class. If you
don't make the base metaclass an instance of itself, you have an
infinite recursion. Also, since a class is an object and there's one
unique common base class for all other classes, the base metaclass has
to subclass this class (else it wouldn't be the unique common base
class...).
</apply-only>
HTH