Diez B. Roggisch
1/16/2008 3:37:00 PM
Dmitry wrote:
> Hi All,
>
> I've trying to develop one Python application, and
> neet to solve one problem. I need to list all classes defined in one
> package (not module!).
>
> Could anybody please show me more convinient (correct) way to
> implement this?
Look at the module inspect and it's predicates. Something like
for name in dir(module_or_package):
if inspect.isclass(getattr(module_or_package, name)):
print "%s is a class" % name
Diez