How to find out which functions exist?
Diez B. Roggisch
deets at nospam.web.de
Wed Oct 24 11:28:26 EDT 2007
More information about the Python-list mailing list
Wed Oct 24 11:28:26 EDT 2007
- Previous message (by thread): How to find out which functions exist?
- Next message (by thread): How to find out which functions exist?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
mrstephengross wrote: >> import module >> from inspect import getmembers, isclass >> classes = getmembers(module, isclass) > > Ok, this makes sense. How can I do it inside the .py file I'm working > on? That is, consider this: > > class A: > pass > class B: > pass > import inspect > print inspect.getmembers(<this file>, inspect.isclass) # how can I > express <this file> ? Then you can use globals(), like this: classes = [v for v in globals().values() if isclass(v)] Diez
- Previous message (by thread): How to find out which functions exist?
- Next message (by thread): How to find out which functions exist?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list