If I do the following
x = 0
y = 0
print(x is y)
I get True
The following code
x = 0
y = 0.0
print(x is y)
outputs False
which is the expected behavior.
But
x = 0.0
y = 0.0
print(x is y)
returns False
. Why does this happen and how to get around it?
My use case is that I need to distinguish 0 and 0.0 from other values in python like False, "", etc which would return True in a x==0 comparison
EDIT:
The linked question in the comments does not answer my question. I need to know how to get around this problem.