[Python-3000] Draft PEP for outer scopes

Neil Toronto ntoronto at cs.byu.edu
Sat Nov 4 03:50:41 CET 2006


Greg Ewing wrote:
> Ka-Ping Yee wrote:
>
>   
>>     nonlocal x = y = 0
>>
>> is equivalent to
>>
>>     nonlocal x; x = y = 0
>>     
>
> This is far from obvious. And what happens if
> you want both x and y to be nonlocal? Can you
> write
>
>    nonlocal x = nonlocal y = 0
>
> If so, this is getting even more complicated
> for very little benefit.
>
>   
>> The point is to make the statement easy to explain.
>>     
>
> It's even easier to explain if assignment isn't
> allowed at all.
>   

Sorry about the "mee to" post, but me too: +1 on no assignment allowed. 
I can't think of any way to do it that would be intuitive and obvious to 
*most* people and wouldn't require a separate FAQ entry besides the one 
that explains 'global' and 'nonlocal.'

Neil



More information about the Python-3000 mailing list