[Python-ideas] Tweaking closures and lexical scoping to include the function being defined

Guido van Rossum guido at python.org
Tue Sep 27 04:48:14 CEST 2011

On Mon, Sep 26, 2011 at 7:43 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Despite what I wrote earlier in the thread, I don't think we actually
> need to declare the idea *dead* if you don't currently like 'nonlocal'
> as the keyword. Perhaps the 'nonlocal' idea will grow on you (it
> certainly did on me, the longer I considered the idea), or perhaps you
> or someone else will come up with an appropriate keyword that everyone
> considers reasonable.

Sorry, from reading the responses, the objection that the other use of
nonlocal refers to scope, not lifetime, seems pretty common, and I
don't think it will go away. You might as well use "def var = expr" as
the syntax and justify it by saying that it is clearly defining
something and syntactically different from function definitions...

OTOH I am happy to let you all bikeshed on a better name.

--Guido van Rossum (python.org/~guido)

More information about the Python-ideas mailing list