On Dec 29, 5:18 am, Dave Angel <da...@ieee.org> wrote: > samwyse wrote: > > Is there any way to get the global namespace of the module in which a > > class was defined? Answers for both Python 2.x and 3.x will be > > cheerfully accepted. > > I don't know if it's the same in general, but consider the following > sequence in 2.6: > > import sys > > class MyClass(object): > pass > > print "class--", dir(MyClass) > print "module--", dir(MyClass.__module__) > mod = sys.modules[MyClass.__module__] > print mod > print "globals--", dir(mod) > > DaveA
Excellent! Exactly what I wanted, but wasn't clever enough to figure out for myself. Thank you very much. -- http://mail.python.org/mailman/listinfo/python-list