Steven D'Aprano writes:

 > But unlike us, the equality operator only has a pinhole view of the 
 > operands. It can't distinguish between your example and this:
 > 
 > x = float('nan')
 > y = some_complex_calculation(x)
 > if x == y:
 >     ...
 > 
 > where y merely happens to end up with the same object as x by some quirk 
 > of implementation.

Note that Mark has already provided a related example of such a quirk
(Decimal(-1).sqrt(), I think it was).
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to