Class list of a module

Laurent.LAFFONT-ST at Laurent.LAFFONT-ST at
Mon Jan 15 11:52:19 CET 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.


Laurent Laffont 

More information about the Python-list mailing list