[Python-Dev] LOAD_NAME & classes

Aahz aahz@pythoncraft.com
Tue, 23 Apr 2002 13:04:25 -0400


On Tue, Apr 23, 2002, Guido van Rossum wrote:
>
> Changing LOAD_FAST so that
> 
>     x = 1
>     def f():
>         print x
> 	x = 2
> 	print x
> 
> prints 1 followed by 2 instead of raising UnboundLocalError would not
> break existing code (except code relying on specific exceptions to be
> raised -- but such code is always exempt from non-breakage
> guarantees).

-1

I agree with Jeremy that such code is by definition broken because it
mixes global and local usage of the same variable within the same scope.
That's a nightmare for visual inspection.

BTW, the indentation came out bizarrely because you used a TAB char for
indentation.  Naughty, naughty.
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

What if there were no rhetorical questions?