Chris Angelico <>:

> On Fri, Aug 11, 2017 at 6:03 AM, Marko Rauhamaa <> wrote:
>> I see no point in CPython's rotation magic.
> Have you ever implemented a hashtable? The most common way to pick a
> bucket for an object is to use modulo on the number of buckets.

Like I said earlier, CPython takes the __hash__() value and scrambles
it. Look for "perturb" in:


>From a comment:

   Now the probe sequence depends (eventually) on every bit in the hash
   code, and the pseudo-scrambling property of recurring on 5*j+1 is
   more valuable, because it quickly magnifies small differences in the
   bits that didn't affect the initial index.


Reply via email to