Determine an object is a subclass of another
Bruno Desthuilliers
bruno.desthuilliers at websiteburo.com
Tue Jan 9 10:08:37 EST 2007
abcd a écrit :
> yea i meant to have animal extend thing and dog extend animal....my
> mistake.
>
> anyways, is there a way to check without having an instance of the
> class?
>
> such as,
>
> isinstance(Dog, (Animal, Thing)) ??
>
>
issubclass(Dog, Animal)
Note that such tests should only be used in a very few specific cases -
certainly not to try&implement some kind of static typing... In Python,
inheritance is mostly about implementation.
More information about the Python-list
mailing list