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/039419.html below:

[Python-Dev] Re: closure semantics

[Python-Dev] Re: closure semantics [Python-Dev] Re: closure semanticsGuido van Rossum guido at python.org
Thu Oct 23 23:40:52 EDT 2003
> Well, the listed variables are "global" to the current local scope.
> I find the rename argument a bit specious.  If I rename a function I
> have to change all the references to it today.  This is just one
> more.  Since "global" is a declarative statement, the compiler can
> tell you immediately that it can't find the old function name.

Right, I tend to agree.

>     Guido> I saw a variant where the syntax was
>     Guido>     'global' vars 'in' 'def'
>     Guido> which solves that concern (though not particularly elegantly).
> 
> I don't see how that can work though.  What does 'def' mean in this
> case?  There can be multiple lexically enclosing functions, any of
> which have the same local variable x which you might want modify.

Yeah, but usually that's not a problem.  The compiler knows about all
those x-es, and uses the innermost (nearest) one.  This matches what
it does when *referencing* a non-local variable, which doesn't need a
global statement.

--Guido van Rossum (home page: http://www.python.org/~guido/)

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