Class list of a module

Laurent.LAFFONT-ST at adixen.fr Laurent.LAFFONT-ST at adixen.fr
Mon Jan 15 05:52:19 EST 2007


> Looks rather simple to me... Anyway, you could avoid calling getattr
> twice, if you iterate over vars(aModule).itervalues()

> def getClassList(aModule):
>     return [cls for cls in vars(aModule).itervalues()
>     if inspect.isclass(cls)]

> (And note that there is no need for using \ at the line ends, because
> of the [])


That's what I've been looking for. Thank you.

Regards, 

Laurent Laffont 





More information about the Python-list mailing list