This must be a FAQ, but I spent five minutes searching, and couldn't find it. In Python, how can I obtain the value that corresponds to a binary operator?
To be more specific; here's an apply-to-8-and-9 function:
def apply_to_8_and_9(fun):
return fun(8,9)
Now, suppose I want to pass the < function to apply-to-8-and-9. I can do this:
apply_to_8_and_9(lambda a,b: a < b)
... but I'd really rather not have to eta-expand the <
operator. Is there some way to avoid this?
Thanks!