Ezio Melotti added the comment:

> Python is designed to be unsurprising; constructs generally mean
> what it looks like they mean.

AFAIK in C "x += 1" is equivalent to "x++", and both are semantically more 
about incrementing (mutating) the value of x than about creating a new value 
that gets assigned to x.
Likewise it seems to me more natural to interpret "x += y" as "add the value of 
y to the object x" than "add x and y together and save the result in x".
Clearly if you are used to other languages with different semantics you might 
expect a different behavior, but you could say the same about the fact that 
int/int gives float on Python 3: it's surprising if you are used to other 
languages like C, but otherwise it's more natural.

> I interpreted this paragraph wrongly, because I interpreted it in the
> only way that made sense given the meaning of these operators in 
> every other language that has them.

It seems to me that the documentation doesn't leave much room for 
interpretation regarding the fact that the object is mutated in place; the only 
problem is that it doesn't specify clearly what are the objects that do this.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16701>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to