[Python-3000] non-local assignment

allyourcode at gmail.com allyourcode at gmail.com
Thu May 29 08:24:47 CEST 2008


I actually read a good portion of the thread that PEP 3099 refers to,
so I thought I had read up on the subject before making my suggestion.
I had also perused that PEP and didn't realize there was no way my
suggestion could be accepted.

I suppose it's too late, but I think it's too bad that a negative
keyword was selected, although it is completely accurate.

On 5/28/08, Chris Rebert <cvrebert at gmail.com> wrote:
> It's been decided to go w/ the "nonlocal" keyword to declare outer
> variables (ala the "global" keyword) rather than using an alternate
> assignment operator (which was one of the competing proposals). It's
> too late to make a change such as your suggestion because PEP 3104 (
> http://www.python.org/dev/peps/pep-3104/ ), which proposed "nonlocal",
> has already been accepted (and BDFL-blessed IIRC).
>
> Furthermore, there's no precedent for Python operators to use both a
> keyword and punctuation together like "set!", and "set" can't be used
> instead as it's the name of a builtin type (in Py3K).
>
> In the future, searching the list archives can be quite helpful.
>
> - Chris Rebert
>
>
> On Wed, May 28, 2008 at 10:55 PM, Daniel Wong <allyourcode at gmail.com> wrote:
>> I'm confused by the section on "no alternate binding operator" in PEP
>> 3099. On the one hand, it says no alternative binding operator will be
>> considered; yet the link provided shows that Guido is in favor of
>> developing a syntax for non-local assignment. Please excuse me if this
>> post violates that rule. Here's my suggestion on what the syntax
>> should look like:
>>
>> set! var val
>>
>> Scheme users will recognize this syntax, which has the distinct
>> advantage of not being confusable with regular assignment; whereas,
>> this is an unfortunate feature of :=, which Guido has already
>> rejected.
>>
>> The way this is supposed to work is you go to the inner-most scope in
>> which var is declared and change its value there to val. If var does
>> not occur in any containing scope, you could raise an
>> UndeclaredVariable exception.
>>
>> Thoughts?
>>
>> Daniel
>> _______________________________________________
>> Python-3000 mailing list
>> Python-3000 at python.org
>> http://mail.python.org/mailman/listinfo/python-3000
>> Unsubscribe:
>> http://mail.python.org/mailman/options/python-3000/cvrebert%40gmail.com
>>
>


More information about the Python-3000 mailing list