Changing Hash Values Across Versions
dickinsm at gmail.com
Thu Jun 11 16:18:30 EDT 2009
On Jun 11, 8:55 pm, Christian Heimes <li... at cheimes.de> wrote:
> Phil Thompson schrieb:
> > How stable should the implementation of, for example, a string's hash
> > across different Python versions?
> > Is it defined that hash("foo") will return the same value for Python 2.5.1,
> > 2.6.1 and 2.6.2?
> The hash of an object is an internal implementation detail. The hash()
> value of an object isn't even stable for the one version of Python. It
> depends on the architecture (32 vs. 64bit OS, maybe even big vs. little
> endian). The hash sums of objects like classes may and most likely do
> change when you restart the interpreter.
What he said. I remember at least one recent hash change: the
algorithm for computing the hash of a long is different in Python
2.5.x and Python 2.6.x.
More information about the Python-list