[Tutor] listing classes

python at bdurham.com python at bdurham.com
Tue May 20 18:59:31 CEST 2008


Thomas,

> import types
> [ name for name in dir(A) if type(eval('A.'+name)) == types.ClassType ]

The == types.ClassType doesn't seem to pick out the classes.

Also, I think you should be returning eval( name ) vs. name so that the
OP gets a list of objects vs. names? (My take on what the poster
wanted).

Malcolm


More information about the Tutor mailing list