[Python-ideas] Disallow orderring comparison to NaN

Stephen J. Turnbull stephen at xemacs.org
Sat Apr 30 07:35:32 CEST 2011


Terry Reedy writes:
 > On 4/29/2011 6:50 PM, Alexander Belopolsky wrote:
 > 
 > > realize that Python does have a mechanism that would allow to
 > > simultaneously raise an exception and deliver the result.  This is
 > > what warnings do.  Since changing NaN<  0 to raise an error would have
 > > to be done by issuing a deprecation warning first, why can't we just
 > > issue appropriate warning on invalid operations?
 > 
 > Adding FloatWarning would probably be easier than changing behavior to 
 > raise an exception. People who care could change into an exception.

+1  That looks both formally compliant and much better than allowing
what is often a programming error to fail silently.





More information about the Python-ideas mailing list