A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/039399.html below:

[Python-Dev] Re: closure semantics

[Python-Dev] Re: closure semanticsJohn Williams jrw at pobox.com
Thu Oct 23 17:40:33 EDT 2003
Skip Montanaro wrote:
> Given that the global keyword or something like it is here to stay (being
> preferable over some attribute-style access) and that global variable writes
> needs to be known to the compiler for future efficiency reasons, I think we
> need to consider modifications of the current global statement.  The best
> thing I've seen so far (I forget who proposed it) is
> 
>     'global' vars [ 'in' named_scope ]
...
> This should be compatible with existing usage.  The only problem I see is
> whether the named_scope needs to be known at compile time or if it can be
> deferred until run time.

How about (to abuse a keyword that's gone unmolested for too long)

   global foo from def

to declare that foo refers a variable in a lexically enclosing function 
definition?  This avoids to need to name a specific function (which IMHO 
is just a source of confusion over the semantics of strange cases) while 
still having some mnemonic value (foo "comes from" an enclosing function 
definition).

jw


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4