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 -- http://mail.python.org/mailman/listinfo/python-list