Dict when defining not returning multi value key error

Terry Reedy tjreedy at udel.edu
Fri Aug 1 17:42:10 EDT 2014


On 8/1/2014 11:39 AM, Marko Rauhamaa wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>>> but hash(x) == hash(y) does NOT imply that x == y.
>>
>> Hello, pigeonhole principle :) If this were false - that is, if equal
>> hashes DID imply equal objects - it would be necessary to completely
>> encode an object's state in its hash, and hashes would be impossibly
>> large. This would, in fact, destroy their value completely.
>
> Well, modern computing assumes precisely:
>
>     hash(x) == hash(y) => x == y

Assuming that a false statement is true does not make it true, and can 
and has gotten 'computing' into trouble.

> That principle is at play with strong authentication (HTTPS et al),
> version control (git et al),

The principle for these applications is

stronghash(x) == stronghash(y) => x == y with probability 1 (or 
indistinguishable from 1).

For mercurial, with no treat model, a 160 bit hash is used. Internet 
applications need more bits and carefully vetted algorithms to hopefully 
make the actual principle true.

-- 
Terry Jan Reedy




More information about the Python-list mailing list