Getting a list of classes in the current module/auto introspection

2005-04-28 Thread Andy Leszczynski
Hi, I have a following problem. Let's say there is a module which could be imported or run as __main__. It is going to contain hundreds of classes, something like that: import moduleA from moduleB import * class A: pass class B: pass class C: pass [...] I would like to

Re: Getting a list of classes in the current module/auto introspection

2005-04-28 Thread Michele Simionato
Any class has a .__module__ attribute giving the name of the module where the class was defined, so you need something like [c for c in globals() if inspect.isclass(c) and c.__module__ == __main__] Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list