[Python-3000] Draft PEP for outer scopes

Steven Bethard steven.bethard at gmail.com
Thu Nov 2 05:36:14 CET 2006


On 11/1/06, Ka-Ping Yee <python at zesty.ca> wrote:
> I think a fairer survey example would be something like this:
>
>     n = 1
>     def f():
>         n = 2
>         def g():
>             global n = 99
>             return n
>         g()
>
>     f()
>     print n
>
> Which 'n' do you expect g() to change?

The only reason I didn't use that in the first place is that is seems
extremely unlikely in real code.  Who uses the same name for a
module-level binding and a function-local binding?

So yes, that's the corner case, but I contend that the corner case
will almost never come up.

Steve
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy


More information about the Python-3000 mailing list