[Python-3000] non-local assignment

Daniel Wong allyourcode at gmail.com
Thu May 29 07:55:34 CEST 2008


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


More information about the Python-3000 mailing list