[Python-3000] Draft PEP for outer scopes
Terry Reedy
tjreedy at udel.edu
Thu Nov 2 04:34:44 CET 2006
"Andrew McNamara" <andrewm at object-craft.com.au> wrote in message
news:20061102014059.BC4BB6F4198 at longblack.object-craft.com.au...
> >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.
No, I (and others, it seems) just never have reason before to clutter the
list with a 'me-too' post.
> But it doesn't mean "top-level" - it already comes with the qualifier
> "module". Even after nearly a decade of python use, I still find that
> slightly unnatural,
Me too ;-)
> and changing "global" to mean "enclosing scope"
> feels only slightly more unnatural.
Me too ;-)
Actually, I would only want a separate keyword would be if one wanted to be
able to write
x = 1
def f():
x = 'a'
def _f():
global x = {}
and have that act differently (as at present) from the inside-out behaviour
of
newkey x = 'whatever'. But I will not write such code and do not want to
see such.
With two different but similar keywords, I would expect to see requests to
be able to write
def _f():
global x = 2
print x
nonlocal x = 'b'
print x
Terry Jan Reedy
More information about the Python-3000
mailing list