Compound Assignment Operators ( +=, *=, etc...)

Tom Christiansen tchrist at
Thu Aug 19 05:19:56 CEST 1999

     [courtesy cc of this posting mailed to cited author]

In comp.lang.python, 
    gmcm at writes:
:[posted & mailed]
:Additional point: If x++ were taken as syntactic sugar, it would have 
:the odd affect of modifying a name binding in place. 
:If more than syntactic sugar, it would do different things depending 
:on whether x was mutable or immutable.

People are probably only thinking of ++ for numbers, and I don't see that
"in place changes" matter there.  There's no reason that it should make
sense on, say lists.  It's a lot easier to survive without ++ than it
is without +=, however. :-)

Even if you do learn to speak correct English, whom are you going to
speak it to?
                --Clarence Darrow

More information about the Python-list mailing list