為什么(0-6)是-6 =假?今天我試著調試我的項目,經過幾個小時的分析,我得到了這個:>>> (0-6) is -6False但,>>> (0-5) is -5True你能解釋一下,為什么?也許這是某種錯誤或非常奇怪的行為。> Python 2.7.3 (default, Apr 24 2012, 00:00:54) [GCC 4.7.0 20120414 (prerelease)] on linux2>>> type(0-6) <type 'int'>>>> type(-6) <type 'int'>>>> type((0-6) is -6)<type 'bool'>>>>
為什么(0-6)是-6 =假?
慕的地6264312
2019-08-26 18:55:21