[Python-3000] Draft PEP for outer scopes

Antoine Pitrou solipsis at pitrou.net
Fri Nov 3 22:51:56 CET 2006


Le vendredi 03 novembre 2006 à 15:19 -0600, Ka-Ping Yee a écrit :
> I suppose that's fine.  Also i guess
> 
>     nonlocal x = y = 0

That's ambiguous.
Is only "x" nonlocal, or are both "x" and "y"?

What's the point anyway? if you write "nonlocal x = 0", it means you
aren't reusing the variable value between calls...
Of course the variable could be re-used by another inner function, but
it's not common to have lots of inner functions sharing variables of a
single outer function (people would rather write a class).




More information about the Python-3000 mailing list