<br><br><div><span class="gmail_quote">On 9/9/07, <b class="gmail_sendername">Larry Hastings</b> <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:</span>
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div bgcolor="#ffffff" text="#000000">
One goal of Jenkin's hashes is uniform distribution, so these functions
presumably lack the serendipitous "similar inputs hash to similar
values" behavior of Python's current hash function. But why is that a
feature? (Not that I doubt Tim Peters!)</div></blockquote><div><br>Because (relatively) small dicts with (broadly speaking) similar keys are quite common in Python. Module and class and instance __dict__s, for instance ;) As Tim mentioned, the dict implementation only looks at part of the actual hash value (depending on the size of the dict) and having hash values close but not the same greatly decreases the chance of collisions in (relatively) small dicts. It's less of a problem for massive dicts with (almost) completely arbitrary keys, but it doesn't exactly hurt there, either.
<br></div></div><br>-- <br>Thomas Wouters <<a href="mailto:firstname.lastname@example.org">email@example.com</a>><br><br>Hi! I'm a .signature virus! copy me into your .signature file to help me spread!