[Python-3000] Draft PEP for outer scopes

Christian Tanzer tanzer at swing.co.at
Thu Nov 2 09:55:41 CET 2006


Ka-Ping Yee <python at zesty.ca> wrote:

> A shorthand form is also permitted, in which ``nonlocal`` is
> prepended to an assignment or augmented assignment statement::
>
>     nonlocal x = 3
>
> The above has exactly the same meaning as ``nonlocal x; x = 3``.

Nice.

> The shorthand form does not allow multiple names.

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.



-- 
Christian Tanzer                                    http://www.c-tanzer.at/



More information about the Python-3000 mailing list