type, object hierarchy?
Bruno Desthuilliers
bruno.42.desthuilliers at wtf.websiteburo.oops.com
Mon Feb 4 04:27:28 EST 2008
7stud a écrit :
> print dir(type) #__mro__ attribute is in here
> print dir(object) #no __mro__ attribute
>
>
> class Mammals(object):
> pass
> class Dog(Mammals):
> pass
>
> print issubclass(Dog, type) #False
> print Dog.__mro__
>
> --output:--
> (<class '__main__.Dog'>, <class '__main__.Mammals'>, <type 'object'>)
>
>
> The output suggests that Dog actually is a subclass of type
Nope. It suggests that Dog is a subclass of object (which is not really
surprising).
More information about the Python-list
mailing list