Introspection: determining parent classes?
Robb Shecter
rs at onsitetech.com
Fri Jun 28 16:07:46 EDT 2002
Hi,
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
like:
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?
Thanks,
Robb
More information about the Python-list
mailing list