【发布时间】:2012-04-12 19:30:34
【问题描述】:
可能重复:
When is a python object's hash computed and why is the hash of -1 different?
如果是 Python,为什么 -1 和 -2 都哈希到相同的数字?
既然有,那么 Python 是如何区分这两个数字的呢?
>>> -1 is -2
False
>>> hash(-1) is hash(-2)
True
>>> hash(-1)
-2
>>> hash(-2)
-2
【问题讨论】:
-
这是一个已知问题 - 我认为这里已经存在问题...