Marcin 'Qrczak' Kowalczyk wrote:
> Ron Adam <[EMAIL PROTECTED]> writes:
> 
>> By not limiting parent to just the parent scope you create exceptions.  The 
>> rule 
>> becomes:
>>
>>      The keyword (*)nonlocal designates a name will be written to in the
>>      closest enclosing "parent" scope *except* when a pre-existing matching 
>> name
>>      exists in a scope further up.
>>
>> To me that is more confusing than always referring to the closest enclosing 
>> scope without exception.
> 
> The rule should be:
> 
> The keyword 'nonlocal' causes the lookup to be performed as if there
> were no assignments to that variable in the scope containing the
> 'nonlocal' declaration.

Plus, if there's no binding in an enclosing scope, an error is raised.

(Which brings up the assymetry to today's global again, but is that really
a problem?)

Georg

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to