> According to the language reference, > > An augmented assignment expression like x += 1 can be > rewritten as x = x + 1 to achieve a similar, but not > exactly equal effect. In the augmented version, x is only > evaluated once. > > I don't consider the two results you posted "similar".
It continues "Also, when possible, the actual operation is performed in-place, meaning that rather than creating a new object and assigning that to the target, the old object is modified instead. ...Similarly, with the exception of the possible in-place behavior, the binary operation performed by augmented assignment is the same as the normal binary operations. " I take the behavior observed to be the exceptional in-place behavior referred to. But this could certainly be clearer. Also, Lib Ref 2.3.6.4 Mutable Sequence Types could have a line added to the table specifying the the operation 's+=x' is the same as s.extend(x). Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list