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

Michele Simionato michele.simionato at gmail.com
Thu Apr 28 10:00:32 EDT 2005


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




More information about the Python-list mailing list