-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <vstinner@python.org>
GH-119334 is a backport of this pull request to the 3.13 branch. |
|
📚 Documentation preview 📚: https://cpython-previews--119214.org.readthedocs.build/