How to examine the inheritance of a class?
John Ladasky
ladasky at my-deja.com
Thu Oct 23 23:50:39 EDT 2008
On Oct 23, 6:56 pm, "Chris Rebert" <c... at rebertia.com> wrote:
> In __bases__, e.g. Spam1.__bases__, which would be (<class '__main__.Foo'>,).
> In practice, you probably just want to use if isinstance(some_obj,
> Foo): which will be true for SpamN instances.
Thank you, Chris. Class.__bases__ is exactly what I wanted to see.
And I thought I had tried isinstance(), and found it lacking -- but I
just tried it again, and it does what I hoped it would do.
More information about the Python-list
mailing list