So I discovered that functions evaluate with comparison operators. E.g.
def randomFunction() :
return None
print randomFunction > 0 # True
print randomFunction > float('inf') #True !!!!
print randomFunction < 0 # False
print randomFunction == 0 # False
This was the cause of a subtle bug where code appeared to be working as an if statement was missing () and something which should mostly evaluate to true was always evaluating true.
Why is this? How is this even implemented when the dir(randomFunction) has no eq method?
It seems incredible that a language that doesnt allow assignment in if statements should allow comparisons between unevaluated functions and a number? I tried to force my debugger to step into it but it thinks the comparison is atomic. Is there some sensible reason behind this or is it just another WAT moment?