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

Mark Dickinson dickinsm at gmail.com
Sat Mar 27 13:28:20 CET 2010

On Sat, Mar 27, 2010 at 10:21 AM, Marcin 'Qrczak' Kowalczyk
<qrczak at knm.org.pl> wrote:
> The original problem with NaN is a consequence of an unfortunate
> decision to unify numeric equality with object equivalence. If they
> were distinguished, their behavior would be obvious:

Agreed, except that it's not clear to me that this was actually an
unfortunate decision.  The results in this context are unfortunate,
yes, but it could well be that distinguishing numeric equality and
object equivalence would add unacceptable complexity to the language
for those trying to learn it.  Questions about 'is' versus '==' are
especially common on the mailing lists, and adding a third equivalence
relation wouldn't help newcomers.


More information about the Python-ideas mailing list