Introspection: determining parent classes?

Robb Shecter rs at
Fri Jun 28 16:07:46 EDT 2002


Is there any way to determine the parent classes given an instance?

I'm writing unit test code, and I want to assert that a particular 
result is a subclass of some other class.  In Java, you can do something 

anInstance.getClass().isSubclassOf( aClass )

I looked through the type(), __class__, etc. info, but these seem to 
just return string-like objects that don't allow further introspection.

Is there an equivalent in Python?


More information about the Python-list mailing list