3 ms·
Do you also believe all built-in types like integers should use named functions instead of operators?
by account42 5y ago
Do you also believe all built-in types like integers should use named functions instead of operators?
- ordu 5y agoNo. I even believe that non-builtin types behaving like numbers might use operators. But lists, arrays, strings behave not like numbers. They allocate memory, they reuse memory for values, they have operations of non O(1) complexity, and so they shouldn't be using operators. If one really wants to, then he might invent new operators for this, like concatenation-operator. I didn't see any reasonable way to do it, but it doesn't mean that such way cannot be devised.
- c-cube 5y agoNumbers in python also allocate memory. Integers are arbitrary precision, so the difference between + and += might also be very relevant for them. And of course there's numpy and matrices which also behave like numbers, or at least like mathematical objects.