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

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Sep 28 12:54:24 CEST 2011


Paul Moore wrote:
> Nonlocal is associated (by its
> position) with the VAR, not with the EXPR. If anything, it says
> "assign this local EXPR to the nonlocal VAR" which implies it's
> equivalent to "nonlocal VAR; VAR = EXPR".

Something that might be slightly more suggestive of
Nick's meaning is

     i = nonlocal i

but then there's no indication that i isn't just an
ordinary local being assigned at call time.

-- 
Greg



More information about the Python-ideas mailing list