I've got a function that takes a binary function as an argument and does some other things using that function. Is there a built-in way to pass the infix + function as a prefix binary function without making a lambda x,y: x + y, i.e. is there some built-in function that acts like +(1,2) = 3? Same question for -, *, /, and **.
Add a comment
|
1 Answer
Ah, it's been like a year at this point, but I stumbled across an answer. All of the infix operations are implemented like normal functions in the operator module. So, for addition you can just refer to operator.add