How to get the types of the parents of an object ?

Terry Reedy tjreedy at udel.edu
Tue Jan 21 08:06:02 EST 2003


> Now my_class is a child of my_super_class. And I want to check if
> my_object is an instance of my_super_class.

Is this what you are looking for?
>>> class mysuper(object): pass
...
>>> class myclass(mysuper): pass
...
>>> myobject=myclass()
>>> isinstance(myobject,mysuper)
1

Terry J. Reedy






More information about the Python-list mailing list