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


Groups > comp.lang.python > #72920

How to use imported function to get current globals

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <1989lzhh@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.131
X-Spam-Level *
X-Spam-Evidence '*H*': 0.75; '*S*': 0.01; 'subject:How': 0.10; 'def': 0.12; "module's": 0.16; 'import': 0.22; 'print': 0.22; 'code': 0.31; 'received:google.com': 0.35; 'charset:us-ascii': 0.36; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'header:Message-Id:1': 0.63; 'here': 0.66; 'subject:get': 0.81
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:content-type:message-id:date:to :content-transfer-encoding:mime-version; bh=JF/SXK+IZ+x7g+q3eCDDHecvw9+YMRHcIrH/TEsuZRg=; b=xicMg4tC/Vg2UuNxRUjECdzNxkAmgYvj5qcmrHjoQT/9AGIG5B3EcHRJaukjlln2ZE PN6JAsJdP+sFexQqUJRZJ1kiF1eas0KQkmEnHlGGa01hLO/jkmDZgKJywdRcuSq1EyIY 1xamgfVTOZc8jqZltbTP9xkrVLx1gYgeobAMEpwrwbA3ZdUios37B7uKFYfPCDjb44tM uQbVa8BtoNM5hn5FmuYcdRqSzieTzqmfTGAZi6X/bL9zrXrkxo9Z2tVBTxS8mfdTmx0t ptuBLL5ZLorKeUw5DG2dqRPk5DlZnT6M0TnbmkQ50x/hE0rzeevGid6NiGv1EqileUBu +2eQ==
X-Received by 10.68.240.34 with SMTP id vx2mr19916617pbc.1.1402162811264; Sat, 07 Jun 2014 10:40:11 -0700 (PDT)
Subject How to use imported function to get current globals
From 1989lzhh <1989lzhh@gmail.com>
Content-Type text/plain; charset=us-ascii
X-Mailer iPhone Mail (11D201)
Date Sun, 8 Jun 2014 01:40:04 +0800
To python_list <python-list@python.org>
Content-Transfer-Encoding 7bit
Mime-Version 1.0 (1.0)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10854.1402162815.18130.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1402162815 news.xs4all.nl 2880 [2001:888:2000:d::a6]:43245
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:72920

Show key headers only | View raw


Here is the code
m1.py
def f():
    print globals()

m2.py
from m1 import f
f()# how to get current module's globals?


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

How to use imported function to get current globals 1989lzhh <1989lzhh@gmail.com> - 2014-06-08 01:40 +0800

csiph-web