4 ms·
varargs are a thing for a reason. Same with keyword arguments. The elephant in this discussion remains the idea that operations are somehow different from fun
by taeric 2y ago
varargs are a thing for a reason. Same with keyword arguments.
The elephant in this discussion remains the idea that operations are somehow different from functions. This is akin to asking what makes a datatype a primitive. There are some that are typically included in that list, but there is no real intrinsic quality of any data that makes it more so.
- seanhunter 2y agoWell yes completely agree. In TFA the author makes some distinctions which seem to me to be more or less arbitrary along these lines. eg Python's "range(min, max,step)" is a ternary operator as far as the author is concerned but but regex substitution "s/pat/subst/flags" is a "datatype constructor" rather than an operator. Not sure why a constructor isn't an operator if range is an operator, especially as the python documentation describes range() as creating an immutable sequence type. > class range(start, stop, step=1) > > Rather than being a function, range is actually an immutable sequence type, as documented in Ranges and Sequence Types — list, tuple, range. https://docs.python.org/3/library/functions.html#func-range https://docs.python.org/3/library/functions.html#func-range From a maths perspective as far as I can see for most "normal maths" an operator is just something which does a mapping between the input domain(s) to the output domain(s) ie it's almost exactly a function. I think when you get to functional analysis there's a more concrete definition in terms of operator algebras but I haven't got there yet myself.