Issue 30932: Identity comparison ("is") fails for floats in Python3 but works in Python2 (original) (raw)
This is not a bug. Whether Python allocates one, or two, float objects for a particular floating point value is dependent on the implementation and not a language guarantee. The language does not promise that two floats with the value 7.3 will be the same object, only that they are equal.
In Python 3.5 on Linux, I can see:
py> 7.3 is 7.3 True py> x = 7.3 py> y = 7.3 py> x is y False
but your results may be different. There is no language promise here, except that x is x
must be true.