Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #72949 > unrolled thread

Re:How to use imported function to get current globals

Started byDave Angel <davea@davea.name>
First post2014-06-07 21:24 -0500
Last post2014-06-07 21:24 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re:How to use imported function to get current globals Dave Angel <davea@davea.name> - 2014-06-07 21:24 -0500

#72949 — Re:How to use imported function to get current globals

FromDave Angel <davea@davea.name>
Date2014-06-07 21:24 -0500
SubjectRe:How to use imported function to get current globals
Message-ID<mailman.10872.1402194206.18130.python-list@python.org>
1989lzhh <1989lzhh@gmail.com> Wrote in message:
> Here is the code
> m1.py
> def f():
>     print globals()
> 
> m2.py
> from m1 import f
> f()# how to get current module's globals?
> 

As others have said, it's probably a bad idea.  I can think of 3
 reasons to try: teacher said so, writing a debugger, 
 transliterating code from a crude language into python.

Could you elaborate on what you really want? Which of those two
 modules is your main script? Which code in which module is trying
 to get which module's globals?  And is the connection static or
 dynamic? And do you want a snapshot of them, or to be able to
 modify and track changes? 




-- 
DaveA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web