[Python-3000] Draft PEP for outer scopes
Ka-Ping Yee
python at zesty.ca
Fri Nov 3 22:19:21 CET 2006
On Thu, 2 Nov 2006, Christian Tanzer wrote:
> As you allow
>
> nonlocal x, y, z
>
> and
>
> x, y, z = 1, 2, 3
>
> is legal Python (and does the right thing), why not allow
>
> nonlocal x, y, z = 1, 2, 3
>
> too?
>
> That's one less rule needed to be learned and enforced.
I suppose that's fine. Also i guess
nonlocal x = y = 0
seems okay. We have to be clear that you can't assign to anything
that you could in a normal assignment though -- e.g.:
nonlocal foo.bar, a[5] = 1, 2
is not allowed.
I've updated the PEP to allow multiple assignment and to specify
the exact grammar of the "nonlocal" statement.
http://zesty.ca/python/pep-3104.html
-- ?!ng
More information about the Python-3000
mailing list