[Python-ideas] checking for identity before comparing built-in objects

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Oct 9 10:19:54 CEST 2012

Oscar Benjamin wrote:
> The main purpose of quiet NaNs is to propagate through computation
> ruining everything they touch.

But they stop doing that as soon as they hit an if statement.
It seems to me that the behaviour chosen for NaN comparison
could just as easily make things go wrong as make them go
right. E.g.

    while not (error < epsilon):

If error ever ends up being NaN, this will go into an
infinite loop.


More information about the Python-ideas mailing list