Why do -1 and -2 both hash to -2 in CPython? [duplicate]
-1 is a reserved value at the C level of CPython which prevents hash functions from being able to produce a hash value of -1. As noted by DSM, the same is not true in IronPython and PyPy where hash(-1) != hash(-2). See this Quora answer: If you write a type in a C extension … Read more