On Sun, Jun 8, 2014 at 10:28 AM, 1989lzhh <1989l...@gmail.com> wrote:
> 发自我的 iPhone
>> 在 Jun 8, 2014，4:52，Chris Angelico <ros...@gmail.com> 写道：
>>> On Sun, Jun 8, 2014 at 3:40 AM, 1989lzhh <1989l...@gmail.com> wrote:
>>> Here is the code
>>> def f():
>>> print globals()
>>> from m1 import f
>>> f()# how to get current module's globals?
>> As Ian said, you almost certainly do not want to do this. But if you
>> have a solid use-case that involves finding the caller's globals, you
>> can do it (in CPython - no idea about other Pythons) with the
> Could you give an example ? I do want to get the caller's globals, so I
> can expose something into current module implicitly. Thanks!
Frankly, no. I don't want to encourage implicitly exposing something
like that! Why do you want that, rather than something explicit and