One last shot at the Augmented Assignment PEP

Alex Martelli aleaxit at
Fri Sep 15 00:14:43 CEST 2000

"Grant Edwards" <ge at nowhere.none> wrote in message
news:_f8w5.1637$94.341375 at
> I agree. I would expect the following to be equivalent. Always.
>     a = a + b
>     a += b
> If they are sometimes equivalent and sometimes not, it seems to
> me to violate the "rule of least surprises."

Not to me.  I don't generally expect two different syntactic
forms to be always equivalent -- there had better be a reason
for two different forms to exist, not just syntax sugar.

> I'd vote for two sets of operators: one that is always an
> assignment, and one that is always an in-place modification of
> a mutable object.  [Though it seems we're arguing a moot
> question once again.]

Clearly.  You seem to deeply dislike polymorphism, and want
a language to offer no operation that is nicely polymorphic
between mutable and immutable objects; with, however, lots
of diverse-looking but deep-down-the-same way to express
its monomorphic semantics.

I, on the other hand, love Python, where polymorphism is a
way of life, and the existence of both mutable and immutable
objects (and their similarities and differences) are deeply
ingrained in the language.  And syntax sugar, while far from
absent, is generally kept at tasteful levels:-).


More information about the Python-list mailing list