effbot at telia.com
Thu Feb 17 13:20:42 EST 2000
Joshua C. Marshall <jayantha at ccs.neu.edu> wrote:
> Given a class object, is there a way to get at its superclass object?
the thing you're looking for is "__bases__"
(it's called "base class" in python, and you can
have more than one)
>>> class A:
>>> class B(A):
(<class __main__.A at 795410>,)
to check if a class is a subclass to any other
class, use "issubclass":
>>> issubclass(B, A)
>>> issubclass(A, B)
hope this helps!
More information about the Python-list