Hi, dir(A) will essentially give you what you want (and a little more)
If you're only interested in classes, you can do something like: import types [ name for name in dir(A) if type(eval('A.'+name)) == types.ClassType ] Thomas Laureano Arcanio wrote:
Hi All, I need to have a listing of all classes defined inside a class body, something like this: class A(object): class B(object): pass class C(object): pass(object): and i need to get the classes to instantiate them.. something like this. classes =[A,B] Any ideas ? do i need meta classes or something ? Thanks in advice. ------------------------------------------------------------------------ _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor