Steven D'Aprano added the comment:

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.

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30932>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to