Mark Dickinson <dicki...@gmail.com> added the comment:

> But the way I would have expected this to work is that a comparison of an 
> integer to a float would first convert the integer to a float

I have a vague memory that that's the way it *did* work once upon a time, many 
many decades ago. But an equality comparison between int and float that simply 
converted the int to a float would break transitivity of equality, leading to 
issues with containment in sets, dicts and lists. Given

n = 2**53
x = 2.**53

if equality comparison worked as you describe you'd have n == x and x == n + 1, 
so to keep transitivity you'd have to make n == n + 1.

In short, the behaviour is very much deliberate.

> That's also what the code says.

Do you have a pointer? This may be a comment bug.

----------

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

Reply via email to