Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:How': 0.10; 'def': 0.12; 'posted': 0.15; "module's": 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'seems': 0.21; 'import': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'received:comcast.net': 0.24; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'is?': 0.30; 'code': 0.31; 'something': 0.35; 'building': 0.35; 'two': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'talking': 0.65; 'here': 0.66; 'subject:get': 0.81 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ned Batchelder Subject: Re: How to use imported function to get current globals Date: Sat, 07 Jun 2014 18:20:59 -0400 References: <602B90F0-E7FE-4887-ADA1-981FD4179EC7@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: c-50-133-228-126.hsd1.ma.comcast.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: <602B90F0-E7FE-4887-ADA1-981FD4179EC7@gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1402179672 news.xs4all.nl 2865 [2001:888:2000:d::a6]:47202 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72933 On 6/7/14 1:40 PM, 1989lzhh wrote: > Here is the code > m1.py > def f(): > print globals() > > m2.py > from m1 import f > f()# how to get current module's globals? > Looking at the code you have posted in your two messages so far, it seems like you are building something very interesting and ambitious. Do you mind talking a bit about what it is? -- Ned Batchelder, http://nedbatchelder.com