python nan != nan

前端 未结 3 1223
夕颜
夕颜 2021-01-03 02:08
Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
[GCC 4.6.3] on linux2
Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.
>>> x =          


        
3条回答
  •  猫巷女王i
    2021-01-03 02:32

    For the "where" part of your questions, look starting at line 391 in Objects/floatobject.c in the Python 2.7.3 source tree. A brief discussion is given about the behavior of NaN == NaN with the implementation following.

    With respect to other cases that exhibit similar behavior, it is certainly possible. I have not done an exhaustive search of the libraries however, so I can't give a definitive answer.

提交回复
热议问题