Getting a list of all classes derived from a base class

Vijairaj R Vijairaj.R at gmail.com
Mon Apr 3 00:51:45 EDT 2006


Hi,
I have a requirement to findout all the classes that are derived from a
single base class.

This is how I do it currently.

class Test:
    case = []

class Test1(Test):
    Test.case.append("Test1")

class Test2(Test):
    Test.case.append("Test2")

1. Is there a better way of doing this.
2. Is there a way to generalize the Test.case.append("TestN")
statements to something like
Test.case.append(__myclass__)

--
Warm Regards,
Vijairaj




More information about the Python-list mailing list