[Python-3000] Draft PEP for outer scopes

Brett Cannon brett at python.org
Thu Nov 2 00:07:28 CET 2006


On 11/1/06, Guido van Rossum <guido at python.org> wrote:
>
> On 11/1/06, Neil Toronto <ntoronto at cs.byu.edu> wrote:
> > Ka-Ping Yee wrote:
> > > I have finally completed a draft of a PEP on rebinding of names
> > > in outer scopes.  I've tried to go back and gather all of the
> > > (amazingly numerous) proposals -- if i've forgotten or misattributed
> > > any, let me know and i'll be happy to correct them.
>
> > It's beautiful. Like Michael said, an impressive amount of history.
>
> Agreed.
>
> > I wondered about this specifically:
> >
> >  > A shorthand form is also permitted, in which nonlocal is prepended to
> >  > an assignment or augmented assignment statement:
> >  >
> >  >     nonlocal x = 3
> >
> > Is a similar statement for globals legal in Py3k? It's not in 2.4
> > (according to my own testing) or 2.5 (according to the grammar). The
> > syntax for 'global' and 'nonlocal' should be almost identical.
>
> It's been proposed and I would endorse it.
>
> 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.
> :-(


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.  Otherwise I would like the 'free' keyword
(I understand why Ping prefers 'nonlocal', but i just don't like it without
a hyphen in it and that isn't about to happen and I have no problem going
with the lambda calculus terminology).

Then again Guido could still get his way since this could end up being quite
the little argument as demonstrated by the list of possible keyword names
and thus require a BDFL pronouncement the way Guido wants it.  =)

-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20061101/71c6697a/attachment.html 


More information about the Python-3000 mailing list