Getting a list of all classes derived from a base class
Dylan Moreland
dylan.moreland at gmail.com
Mon Apr 3 03:50:48 EDT 2006
Alex Martelli wrote:
> Vijairaj R <Vijairaj.R at gmail.com> wrote:
> ...
> > class Test:
>
> do not use old-style classes: they exist ONLY for backwards
> compatibility.
>
> Make you class Test new-style:
>
> class Test(object):
> ...
>
>
> and you can call Test.__subclasses__() to get a list of all extant
> subclassed of Test at any time.
>
>
> Alex
Thanks Alex. That's a new one to me -- new-style classes have so many
strange properties.
More information about the Python-list
mailing list