Hash stability

Terry Reedy tjreedy at udel.edu
Sat Jan 14 23:07:13 EST 2012


On 1/14/2012 9:26 PM, Roy Smith wrote:
>   Steven D'Aprano<steve+comp.lang.python at pearwood.info>  wrote:
>> How many people rely on hash(some_string) being stable across Python
>> versions? Does anyone have code that will be broken if the string hashing
>> algorithm changes?
>
> I would never rely on something like that unless the docs unambiguously
> stated it were so.  Which they don't.  All I can find about hash() is:
>
> "Return the hash value of the object (if it has one).

Based on the pydev discussion since, it appears that enough people have 
inferred stability either from that or empirical stability that it will 
not be broken, by default, in pre-3.3 releases. What ever option is 
chosen to guard against attacks will probably be the default in 3.3.

-- 
Terry Jan Reedy




More information about the Python-list mailing list