3 ms·
> Python uses the identity function for number hashes, because if you're inserting mostly sequential numbers into a dict this gives you better cache performance
by ot 10y ago
> Python uses the identity function for number hashes, because if you're inserting mostly sequential numbers into a dict this gives you better cache performance.
That's a good idea when you control both the hash function and the hashtable implementation, as in the Python interpreter, so you can make assumptions on both sides.
My point was that when using composable templates, as in the STL, the hash function should not make any assumptions about the hash table, and vice versa.