[Python-Dev] Using and binding relative names (was Re: PEP forBetter Control of Nested Lexical Scopes)

Ron Adam rrr at ronadam.com
Sun Feb 26 20:47:18 CET 2006


Terry Reedy wrote:
> "Almann T. Goo" <almann.goo at gmail.com> wrote in message 
> news:7e9b97090602252315mf6d4686ud86dd5163ea76b37 at mail.gmail.com...
>> On 2/26/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>>> Alternatively, 'global' could be redefined to mean
>>> what we're thinking of for 'outer'. Then there would
>>> be no change in keywordage.
>>> Given the rarity of global statement usage to begin
>>> with, I'd say that narrows things down to something
>>> well within the range of acceptable breakage in 3.0.
>> You read my mind--I made a reply similar to this on another branch of
>> this thread just minutes ago :).
>>
>> I am curious to see what the community thinks about this.
> 
> I *think* I like this better than more complicated proposals.  I don't 
> think I would ever have a problem with the intermediate scope masking the 
> module scope.  After all, if I really meant to access the current global 
> scope from a nested function, I simply would not use that name in the 
> intermediate scope.
> 
> tjr

Would this apply to reading intermediate scopes without the global keyword?

How would you know you aren't in inadvertently masking a name in a 
function you call?

In most cases it will probably break something in an obvious way, but I 
suppose in some cases it won't be so obvious.

Ron



More information about the Python-Dev mailing list