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

Stephen J. Turnbull stephen at xemacs.org
Tue Oct 9 02:50:52 CEST 2012


Terry Reedy writes:

 > I wonder if it would be helpful to make a NaN subclass of floats with 
 > its own arithmetic and comparison methods.

It can't be helpful, unless you go a lot further.  Specifically, you'd
need to require containers to check every element for NaN-ness.  That
doesn't seem very practical.

In any case, the presentation by Kahan (cited earlier by Alexander
himself) demolishes the idea that any sort of attempt to implement
DWIM for floats in a programming language can succeed at the present
state of the art.  The best we can get is DWGM ("do what Guido means",
even if what Guido means is "ask the Timbot"<wink/>).

Kahan pretty explicitly endorses this approach, by the way.  At least
in the context of choosing default policy for IEEE 754 Exceptions.




More information about the Python-ideas mailing list