hash values and equality

Chris Angelico rosuav at gmail.com
Fri May 20 12:20:04 EDT 2011


On Sat, May 21, 2011 at 1:50 AM, MRAB <python at mrabarnett.plus.com> wrote:
> [snip]
> Is this strictly true? I thought that the hash value, an integer, is
> moduloed (Is that how you spell it? Looks weird!) with the number of
> array elements to give an index into the array, so different hashes
> could give the same index, and objects with different hashes could be
> stored in the same 'bucket'.

There can always be hash collisions between different objects, but the
assumption is that two identical objects will _always_ "collide".

Chris Angelico



More information about the Python-list mailing list