
Oct. 25, 2003
11:16 p.m.
No way. There's nothing that guarantees that a+=b has the same semantics as a+b, and in fact for lists it doesn't.
You mean because += is more permissive (accepts any sequence RHS while + insists the RHS be specifically a list)? I don't see how this would make it bad to use += instead of + -- if we let the user sum up a mix of (e.g.) strings and tuples, why are we hurting him?
We specifically decided that sum() wasn't allowed for strings, because it's a quadratic algorithm. Other sequences are just as bad, we just didn't expect that to be a common case. Also see my not-so-far-fetched example of a semantic change. --Guido van Rossum (home page: http://www.python.org/~guido/)