[Python-Dev] Explicit Lexical Scoping (pre-PEP?)
Phillip J. Eby
pje at telecommunity.com
Wed Jul 5 17:57:03 CEST 2006
At 05:40 AM 7/5/2006 -0400, Scott Dial wrote:
>Guido van Rossum wrote:
> > Would this also use ..num to refer to num in an outer scope two levels
> removed?
>
>I realize this was a wink, but it is a valid problem with the
>"dot"-proposal.
Actually, it isn't. :) See below.
>def foo(n):
> def bar(n):
> def baz():
> return .n
>
>So, which 'n' outer 'n' is being referenced?
Notice that this is a made-up example. Existing Python scoping rules don't
allow this! Thus your example is not a bug, it's a feature request. And I
say we say "no" to adding this feature. ;-)
More information about the Python-Dev
mailing list