how can get the module global symbol table from a function or method which it is called?

Alex Martelli aleax at mac.com
Sun Jun 18 01:24:52 EDT 2006


ygao <ygao2004 at gmail.com> wrote:

> when a function or method is called,how can get the module global
> symbol table from which
> it is called,not  the module where it is defined(this is easy).
> thanks!

You can play with module inspect, or sys._getframe, but they're meant
essentially for *debugging* purposes -- if what you have in mind is not
related to debugging, but rather some hack to design a highly unPythonic
API, I earnestly urge you to reconsider your design intent.


Alex



More information about the Python-list mailing list