Update to PEP 227 (static scoping)

Jeremy Hylton jeremy at alum.mit.edu
Wed Feb 21 17:43:32 EST 2001


>>>>> "DD" == Denys Duchier <Denys.Duchier at ps.uni-sb.de> writes:

  DD> Jeremy Hylton <jeremy at alum.mit.edu> writes:
  >> Rebinding names in enclosing scopes
  [...]

  DD> if "global x" was instead allowed to mean "the x in the
  DD> innermost enclosing scope that defines one (or the global scope
  DD> otherwise)", wouldn't that solve the problem.  It wouldn't be
  DD> semantically backward compatible, but, in practice, would that
  DD> break a lot of existing programs and require too high a cost for
  DD> fixing them?  Just wondering.

This was an option considered early on, but abandoned because
... Guido didn't like it?  I know he didn't, but I don't recall
exactly why.  A few issues come to mind:

 - It is odd to use the name "global" for something that does not mean
   global.  This alone is enough to reject it.  If we're going to add
   a special declaration statement, it ought to have a clear name.

 - It will break code that depends on global meaning "global" (or
   should I have the scare quotes the other way <wink>).  If we're
   going to break code, there's no point in breaking code that was
   being explicit about what it was doing.

As for using some other word, I'm neutral.  I'm not sure how much the
rebinding will be used, and I'm reluctant to get into a debate about
how to spell things and what to call them.  

the-dict-iteration-blues-are-getting-to-me-ly y'rs,
Jeremy
 




More information about the Python-list mailing list