Other classes in a module

Peter Otten __peter__ at web.de
Sun Mar 25 18:19:51 CEST 2007


Roland Hedberg wrote:

> Can an instance of a class in a module, in any simple way find out which
> other classes that exists in said module ?

set(v for v in globals().values() if inspect.isclass(v) and v.__module__ ==
__name__)

Peter




More information about the Python-list mailing list