Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well 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

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: