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

Antoine Pitrou solipsis at pitrou.net
Mon Oct 8 08:26:28 CEST 2012


On Sun, 07 Oct 2012 22:35:17 -0400
Ned Batchelder <ned at nedbatchelder.com>
wrote:
> I don't understand the reluctance to address a common conceptual 
> speed-bump in the docs.  After all, the tutorial has an entire chapter 
> (http://docs.python.org/tutorial/floatingpoint.html) that explains how 
> floats work, even though they work exactly as IEEE 754 says they should.
> 
> A sentence in section 5.4 (Numeric Types) would help.  Something like, 
> "In accordance with the IEEE 754 standard, NaN's are not equal to any 
> value, even another NaN.  This is because NaN doesn't represent a 
> particular number, it represents an unknown result, and there is no way 
> to know if one unknown result is equal to another unknown result."

+1

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net





More information about the Python-ideas mailing list