sum(strings)

Paul Rubin http
Fri Jun 20 14:05:34 EDT 2003


mwilson at the-wire.com (Mel Wilson) writes:
>    Interesting point arose the other day.. using '+' to concatenate
> strings is wrong, because concatenation isn't commutative.

No biggie, lots of matrix packages use * for matrix multiplication
and that isn't commutative either.

>    Not that it would necessarily affect my thinking if I were
> designing a computer language, but it is a sensible point.  It might
> trip up a naive optimizer.

That would be a buggy optimizer.  If + isn't necessarily commutative,
the optimizer shouldn't assume that it is commutative.




More information about the Python-list mailing list