[Python-Dev] nonlocal x = value
alexander.belopolsky at gmail.com
Fri Dec 17 19:00:53 CET 2010
On Fri, Dec 17, 2010 at 12:33 PM, Benjamin Peterson <benjamin at python.org> wrote:
>> Another +1 for the same reasons. Also, since global does not allow
>> assignment, neither should nonlocal.
> Note that the PEP stated that global would also be extended.
I missed that, so for future reference, the PEP says:
A shorthand form is also permitted, in which nonlocal is prepended to
an assignment or augmented assignment:
nonlocal x = 3
The above has exactly the same meaning as nonlocal x; x = 3. (Guido
supports a similar form of the global statement.)
and refers to Guido's post at
In any case, the relevant issue is
and it should probably be marked as "after moratorium". Meanwhile an
implementation status note can be added to the PEP to avoid this issue
being brought up again.
More information about the Python-Dev