all subclasses of x in module

Jason Orendorff jason at jorendorff.com
Thu Jan 24 16:49:10 EST 2002


>    for class in currentModule.classes:    # This is the only part I don't
> know how to do.

for cls in globals().values(): ...

Remember, "class" is a keyword.

In Python 2.2, if BillableItemStrategy is a new-style class (that is,
if it subclasses object), then it has a __subclasses__() method that
returns a list of its immediate subclasses, whereever they are defined.

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list