A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-April/023466.html below:

[Python-Dev] LOAD_NAME & classes

[Python-Dev] LOAD_NAME & classes [Python-Dev] LOAD_NAME & classesJeremy Hylton jeremy@zope.com
Tue, 23 Apr 2002 12:06:37 -0400
>>>>> "GvR" == Guido van Rossum <guido@python.org> writes:

  GvR> Changing LOAD_FAST so that

  GvR>  x = 1 
  GvR>  def f():
  GvR>      print x
  GvR> 	    x = 2
  GvR> 	    print x

  GvR> prints 1 followed by 2 instead of raising UnboundLocalError
  GvR> would not break existing code (except code relying on specific
  GvR> exceptions to be raised -- but such code is always exempt from
  GvR> non-breakage guarantees).

It wouldn't break existing code, but it would encourage the existence
of broken code.  It's asking for trouble to write a function that uses
a local and a global with the same name.  I don't think we should bend
the rules to accommodate this kind of confusion.

Jeremy






RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4