Changing Hash Values Across Versions

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Jun 11 14:40:06 EDT 2009


En Thu, 11 Jun 2009 13:56:17 -0300, Phil Thompson  
<phil at riverbankcomputing.com> escribió:

> How stable should the implementation of, for example, a string's hash
> across different Python versions?

I cannot find any such guarantee in the documentation:
http://docs.python.org/reference/datamodel.html

> Is it defined that hash("foo") will return the same value for Python  
> 2.5.1, 2.6.1 and 2.6.2?

I've tested and it does, all versions since Python 1.5 up to 3.0.1. But  
you should not rely on that.
What do you want to do exactly?

-- 
Gabriel Genellina




More information about the Python-list mailing list