[Python-ideas] Globalize lonely augmented assignment

Bruce Leban bruce at leapyear.org
Sun Jun 13 15:15:33 CEST 2010


Huh? That makes no sense.
   a[x]=x
is not
    a = a [] x
or anything like that. Language decisions shouldn't be made based on wrong
understandings of how the language works.

As to the idea of turning a guaranteed run time error into a compile time
error I'm usually in favor of that. If it doesn't muck up the compiler.

--- Bruce
(via android)

On Jun 13, 2010 5:54 AM, "Demur Rumed" <junkmute at hotmail.com> wrote:

> > But if the programmer intended a to be global, the *only*
> > reason it's a bug is the current s...
a=[1,2,3]
def f(x):a[x]=x
f(0)

Some like to think of []= as a form of augmented assignment
Currently, []= doesn't align with other augmenteds on this point
That doesn't seem very consistent. Add on that augmented
assignment is the only globalizing store statement which also
dereferences, and consistency doesn't seem to be a strong point
against this proposal

------------------------------
Jeux Messenger : mettez vos amis au défi! Jeux
Messenger!<http://go.microsoft.com/?linkid=9734391>

_______________________________________________
Python-ideas mailing list
Python-ideas at python.org
http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100613/ef7b4405/attachment.html>


More information about the Python-ideas mailing list