|
|
|
|
|
by throwaway283719
4215 days ago
|
|
You think it's a "bad" design decision because you think that a Python list should represent a vector of numbers (not even an array - a mathematical vector). But a list is much more than that - conceptually it's any ordered collection of things, and not necessarily even the same type of thing. Overloading `+` to mean concatenation and `*` to mean replication means that the operators can work with any kind of list, not just lists that are mathematical vectors. If you do want a mathematical vector, you should use a numpy array - not only are you making it clear that you have a vector of numbers, but your operations will be more efficient (because using a numpy array guarantees that the elements in it are all of the same type, so you don't have to do type dispatching on every element). |
|