Ian Clark wrote: > Torsten Bronger wrote: >> Hallöchen! >> >> How can I get a list with all classes defined in the current module? >> Thank you! >> >> Tschö, >> Torsten. >> > > Assuming you want to see all classes in the re module: > > >>> import re > >>> help(re) #best way > >>> > >>> def isclass(cls): > ... try: > ... return issubclass(cls, cls) > ... except TypeError: > ... pass > ... return False > ... > >>> [cls for cls in dir(re) if isclass(getattr(re, cls))] > ['Scanner', '_pattern_type', 'error'] > > Ian >
I love this list, I learn something new everyday. Didn't know about inspect.isclass(). Ignore this post and look at Lawrence's. Ian -- http://mail.python.org/mailman/listinfo/python-list