我对python中的nan != nan感兴趣.为了明确起见,我知道nan应该按照定义具有类似的行为,我是在问如何而不是为什么.在哪里实施?还有其他类似的对象吗?
I'm interested in how nan != nan in python. And just to clarify, I know nan is supposed to behave like that by definition, I'm asking about how not about why. Where is that implemented? Is there any other object which behaves like that?
推荐答案对于问题的哪里"部分,请看Python 2.7.3源代码树中Objects/floatobject.c中的第391行.下面将对有关NaN == NaN的行为进行简要讨论.
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.
更多推荐
蟒蛇南!=南
发布评论