This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients ashwch, benrg, docs@python, ezio.melotti, r.david.murray
Date 2013-01-24.06:22:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1359008542.86.0.495095094533.issue16701@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2013-01-24 06:22:22ezio.melottisetrecipients: + ezio.melotti, r.david.murray, docs@python, benrg, ashwch
2013-01-24 06:22:22ezio.melottisetmessageid: <1359008542.86.0.495095094533.issue16701@psf.upfronthosting.co.za>
2013-01-24 06:22:22ezio.melottilinkissue16701 messages
2013-01-24 06:22:22ezio.melotticreate