Comparing an object againts a numeric value is quite a hassle in Python. Some objects compare smoothly (e.g 0 == 0.0), but others don't (e.g. "0" == 0, same when comparing an object implementing __int__ or __float__ to a number).
Also what should happen if you compare a float (probably being inaccurate anyway) with an integer? Doing an exact comparison of numbers just feels unnatural and is causing a lot of confusion.
I fixed this! With this PR all of the following evaluate to True:
Comparing an object againts a numeric value is quite a hassle in Python. Some objects compare smoothly (e.g
0 == 0.0
), but others don't (e.g."0" == 0
, same when comparing an object implementing__int__
or__float__
to a number).Also what should happen if you compare a float (probably being inaccurate anyway) with an integer? Doing an exact comparison of numbers just feels unnatural and is causing a lot of confusion.
I fixed this! With this PR all of the following evaluate to True: