[Python-3000] Draft PEP for outer scopes
Steven Bethard
steven.bethard at gmail.com
Thu Nov 2 04:39:35 CET 2006
Guido wrote:
> My personal preference is still to abuse 'global' instead of adding a
> new, ugly keyword. That would make the syntax for global and nonlocal
> completely identical. :-) But I seem to be alone in this preference.
Brett wrote:
> Seeing Guido have a sad face is enough to force me to have an opinon. I
> personally always viewed 'global' as "this variable is not local", so making
> it truly mean that works for me.
Ka-Ping Yee wrote:
> Would it help at all to survey some folks to see how many interpret
> "global variable" to mean "top-level" vs. "anything nonlocal"?
I don't think that'll really be worth it. I'd be amazed if people
didn't expect it to mean "top-level". The real question is, if people
see something like this::
def f():
n = 0
def g(i):
global n
n += i
return g
func = f()
print func(), func()
what would they expect it to do? If you need to run a survey, that's
probably the one to run. (Of course a different code example could be
used, but you get the idea).
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