我有以下简单的代码。只是混淆了为什么第二次评估是真的。有谁可以向我解释一下?那么"之间究竟有什么区别呢?#34;和" =="?
a = float("inf")
print a != float("inf")
print a is not float("inf") # why is this True?
b = 1
print b != 1
print b is not 1
c = int(1)
print c != int(1)
print c != int(1)
输出:
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.8.2] on linux
False
True
False
False
False
False