Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29453
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <t@jollybox.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'exception': 0.03; '[1]:': 0.09; '[2]:': 0.09; 'effect.': 0.09; 'nameerror:': 0.09; 'def': 0.10; '#this': 0.16; "isn't.": 0.16; 'scope.': 0.16; 'wrote:': 0.17; '>>>': 0.18; '"",': 0.22; 'modifying': 0.22; 'defined': 0.22; 'this:': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; '(most': 0.27; 'dictionary': 0.29; 'case,': 0.29; 'no,': 0.29; 'returned': 0.30; 'stuff': 0.30; 'file': 0.32; 'print': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'pm,': 0.35; 'subject:?': 0.35; 'there': 0.35; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'received:62': 0.62; 'email addr:gmail.com': 0.63; 'wired': 0.65; 'subject:this': 0.84; 'from:addr:t': 0.84; 'received:62.75': 0.84 |
| Date | Tue, 18 Sep 2012 23:51:13 +0200 |
| From | Thomas Jollans <t@jollybox.de> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: User defined lexical scoping... can I do this? |
| References | <d9aec95e-aedb-442d-ab6d-320f43f61b93@googlegroups.com> <f366b2f6-781a-4d66-9386-6be75f631ee3@googlegroups.com> |
| In-Reply-To | <f366b2f6-781a-4d66-9386-6be75f631ee3@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.892.1348005076.27098.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1348005076 news.xs4all.nl 6857 [2001:888:2000:d::a6]:55427 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:29453 |
Show key headers only | View raw
On 09/18/2012 10:50 PM, weissman.mark@gmail.com wrote: > Well there's wired stuff like this: > > In [1]: locals()["x"] = 5 > > In [2]: print x > 5 > No, there isn't. Modifying the dictionary returned by locals() has no effect. >>> def f (): ... locals()["x"] = 1 ... return x ... >>> f () Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in f NameError: global name 'x' is not defined >>> >>> locals()["x"] = 1 >>> x 1 >>> #this works because ... locals() is globals() True >>> The exception is the case when local scope is identical to global scope. In this case, locals() has globals() semantics.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
User defined lexical scoping... can I do this? porkfried <weissman.mark@gmail.com> - 2012-09-18 13:10 -0700
Re: User defined lexical scoping... can I do this? Thomas Jollans <t@jollybox.de> - 2012-09-18 22:31 +0200
Re: User defined lexical scoping... can I do this? weissman.mark@gmail.com - 2012-09-18 13:50 -0700
Re: User defined lexical scoping... can I do this? Thomas Jollans <t@jollybox.de> - 2012-09-18 23:51 +0200
Re: User defined lexical scoping... can I do this? Terry Reedy <tjreedy@udel.edu> - 2012-09-18 21:38 -0400
Re: User defined lexical scoping... can I do this? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-19 04:03 +0000
Re: User defined lexical scoping... can I do this? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-19 00:47 +0100
csiph-web