Tim Peters <[email protected]> added the comment:
Also worth noting: other projects need to combine hashes too. Here's a 64-bit
version of the highly regarded C++ Boost[1] library's hash_combine() function
(I replaced its 32-bit int literal with "a random" 64-bit one):
x ^= (Py_uhash_t)y + 0x94ae1875aa5647f1UL + (x << 6) + (x >> 2);
It's very cheap. It also sucks horribly if used as the guts Python's tuple
hash loop ;-)
This isn't a paradox. Best I can tell, Python may be unique in trying _not_ to
make all hashes "look random". If you have only randomish hashes to combine,
the Boost approach works fine.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com