[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: Why float('Nan') == float('Nan') is False

Avi Gross wrote:
> I can see why you may be wondering. You see the nan concept as having a
> specific spelling using all lowercase and to an extent you are right.

No, he's talking about this particular line from the transcript you

 >>>float("  nan")
 > Nan

This suggests that the interpreter printed out that particular
nan value as "Nan" with a capital N. But that's not what my
Python 3.5.1 interpreter does:

Python 3.5.1 (default, Jun  1 2016, 13:15:26)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> float("  nan")

Grant was asking whether that's *really* what your interpreter
printed out, and if so, which version of Python it was, because
it's quite a surprising thing for it to do.

Personally I think it's more likely that the N got capitalised
somehow on the way from your terminal window to the mail message.