3 ms·
* on lists can also mean elementwise multiplication, dot or cross product if you treat them as vectors. There's no way to choose the objectively best meaning.
by ajuc 12y ago
* on lists can also mean elementwise multiplication, dot or cross product if you treat them as vectors. There's no way to choose the objectively best meaning. I'd even argue that vector math isn't the most popular use for lists in python, not because of + and * semantics, but because of performance.
So it was good design decision not to bother with math semantics for general use datastructure.
And besides Python has nice general syntax for elementwise operations if you don't care about performance:
[x*y for (x,y) in zip(xs,ys)]
I agree it would be better not to implement + for lists at all.