type, object hierarchy?

Robert Kern robert.kern at gmail.com
Mon Feb 4 00:59:09 EST 2008


7stud wrote:
> On Feb 3, 10:28 pm, 7stud <bbxx789_0... at yahoo.com> wrote:
>> From the docs:
>>
>> issubclass(class, classinfo)
>> Return true if class is a subclass (direct or indirect) of classinfo.
> 
> print issubclass(Dog, object)  #True
> print issubclass(type, object)  #True
> print issubclass(Dog, type)   #False

And if you want to really blow your mind,

print isinstance(type, object)  # True
print isinstance(object, type)  # True

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list