[Python-Dev] Explicit Lexical Scoping (pre-PEP?)

Talin talin at acm.org
Mon Jul 10 01:27:27 CEST 2006


Ka-Ping Yee wrote:
> On Sun, 9 Jul 2006, Andrew Koenig wrote:
> 
>>>Sounds reasonable to me.  If we're talking py3k I'd chuck "global" as a
>>>keyword though and replace it with something like "outer".
>>
>>I must say that I don't like "outer" any more than I like "global."  The
>>problem is that in both cases we are selecting the *inner*most definition
>>that isn't in the current scope.
> 
> 
> That's why "nonlocal" is a better choice in my opinion.

Some alternatives:

     use x
     using x
     with x     -- recycle a keyword?
     reuse x
     use extant x
     share x
     common x
     same x
     borrow x
     existing x

Although, to be perfectly honest, the longer this discussion goes on, 
the more that I find that I'm not buying Guido's argument about it being 
better to define this at the point of use rather than at the point of 
definition. I agree with him that "point of use" is more Pythonic, but 
I'm also beginning to believe that there are some good reasons why many 
other languages do it the other way.

Part of the reason why its so hard to name this feature is that it's 
real name is something like "Hey, Python, you know that cool funky thing 
you do with defining variables in the same scope as they are assigned? 
Well, don't do that here."

-- Talin


More information about the Python-Dev mailing list