Message 81269 - Python tracker (original) (raw)

Sometimes, the default hash for user-defined object is not equal to the id of the object:

In [1]: class A: ...: pass

In [2]: a=A()

In [3]: id(a),hash(a) Out[3]: (3082955212L, -1212012084)

The test box has an AMD Sempron, a 64bit CPU archictecture emulating a 32bit one. This following relation can be deduced:

hash(a)=id(a)-2**32