可能重複:
Python 「is」 operator behaves unexpectedly with integers
Why (0-6) is -6 = False?獲取而減法操作怪異的結果在Python
>>> (0 - 10) is -10
False
>>> (0 - 5) is -5
True
任何人都可以解釋我,我如何獲得在一個案件和對錯在另一種情況下進行相同的操作...
一些更古怪......
>>> (0 - 10) is (0 - 10)
False
另請參見[蟒「是」運算符整數異常行爲(http://stackoverflow.com/q/306313) – 2012-07-17 07:11:42