Chris Angelico <ros...@gmail.com>: > On Fri, Aug 11, 2017 at 6:03 AM, Marko Rauhamaa <ma...@pacujo.net> 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: <URL: https://github.com/python/cpython/blob/master/Objects/dictobject.c> >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. Marko -- https://mail.python.org/mailman/listinfo/python-list