[Python-ideas] Why is nan != nan?

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Mar 26 02:25:06 CET 2010

spir ☣ wrote:

> (Else there should be a distinction between equality assignment and identity assignemt?
> 	b = a	# ==> a is b and a == b
> 	b := a	# ==> a is b and possibly a == b

Eiffel's position on this seems to be that there should
be no distinction -- a copy of a value should always
compare equal to the original value, regardless of type.

Eiffel even seems to extend this to conversions, so that
if you convert an int to a float, the resulting float should
compare equal to the original int, even if some precision
was lost in the conversion.

(Incidentally, that's one principle we would be choosing
*not* to follow if we decide to compare floats and Decimals
based on their exact values.)


More information about the Python-ideas mailing list