我举了一个例子:
a = 200 + 56
b = 256
c = 200 + 57
d = 257
print('%r == %r: %r' % (a, b, a == b))
print('%r is %r: %r' % (a, b, a is b))
print('%r == %r: %r' % (c, d, c == d))
print('%r is %r: %r' % (c, d, c is d))
# Result:
# 256 == 256: True
# 256 is 256: True
# 257 == 257: True
# 257 is 257: False
请为我解释,为什么257 is 257: False
? (256 is 256: True
)