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

Chris Angelico rosuav at gmail.com
Wed Feb 13 14:58:52 EST 2019


On Thu, Feb 14, 2019 at 6:55 AM Grant Edwards <grant.b.edwards at gmail.com> wrote:
>
> On 2019-02-13, Schachner, Joseph <Joseph.Schachner at Teledyne.com> wrote:
>
> > This makes some sense because NAN is Not A Number, so any comparison
> > to a number fails.
>
> Ah, but you now seem to be conflating "comparison fails" with
> "comparison has a boolean value of False".
>
> The alternative to (nan == nan) => False is probably not (nan == nan)
> => True: it's (nan == nan) => exception.

Or (nan == nan) => nan, which is what "infections nan" would be like.
(Compare NULL.)

ChrisA



More information about the Python-list mailing list