[Q] How to get global namespace of __main__?

Daehyok Shin sdhyok at email.unc.edu
Sat Oct 20 20:37:39 EDT 2001


For a specialized task of my own, I have to get a global namespace of python
interactive environment from a function in a module. The following example
simplified it.
How can I solve the problem? Thanks in advance.

Inside python interactive environment:
>from mymod import put
>x = globals()
>put()

Inside mymod module:
def put():
   y = ???? #y should be the same as x.

--
Daehyok Shin (Peter)






More information about the Python-list mailing list