gh-111389: Add PyHASH_MULTIPLIER constant#119214
Conversation
|
The private A code search on PyPI top 7,500 projects (2024-03-16) finds 4 projects using it:
|
gpshead
left a comment
There was a problem hiding this comment.
This makes sense, no harm in this being public even if I think it is odd that anyone uses it.
It's a good prime number to increase to implement good hash function. Using a random number can lead to more collision. cc @mdickinson |
Change seems reasonable to me; the value is potentially useful to have available if you're implementing something complex-like in a C extension and need equality to behave well with respect to Python's |
I don't know about the specific case of floating point objects, but the constant is used by at least 4 projects: #119214 (comment) |
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
(cherry picked from commit f6da790) Co-authored-by: Victor Stinner <[email protected]>
|
GH-119334 is a backport of this pull request to the 3.13 branch. |
|
📚 Documentation preview 📚: https://cpython-previews--119214.org.readthedocs.build/