[Tutor] Implementation of list comparison operators

David Rock david at graniteweb.com
Thu Jan 17 17:41:27 EST 2019


> On Jan 17, 2019, at 16:13, Peter Otten <__peter__ at web.de> wrote:
> 
> David Rock wrote:
> 
>> both a and nan are floats, so why does a == a work, but nan == nan
>> doesn’t?
> 
> It does "work", it's only produces a result you didn't expect ;) 
> Python just follows the standard here
> 
> https://en.wikipedia.org/wiki/IEEE_754
> https://en.wikipedia.org/wiki/NaN#Comparison_with_NaN
> 
> Also:
> 
> https://stackoverflow.com/questions/10034149/why-is-nan-not-equal-to-nan

Touché :-)


— 
David Rock
david at graniteweb.com






More information about the Tutor mailing list