mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
- Issue #18440: Clarify that hash()
can truncate the value returned from an
object's custom `__hash__()` method.
This commit is contained in:
parent
48830035e5
commit
224a599c0c
3 changed files with 27 additions and 8 deletions
|
@ -583,11 +583,16 @@ are always available. They are listed here in alphabetical order.
|
|||
|
||||
.. function:: hash(object)
|
||||
|
||||
Return the hash value of the object (if it has one). Hash values are integers.
|
||||
They are used to quickly compare dictionary keys during a dictionary lookup.
|
||||
Numeric values that compare equal have the same hash value (even if they are of
|
||||
different types, as is the case for 1 and 1.0).
|
||||
Return the hash value of the object (if it has one). Hash values are
|
||||
integers. They are used to quickly compare dictionary keys during a
|
||||
dictionary lookup. Numeric values that compare equal have the same hash
|
||||
value (even if they are of different types, as is the case for 1 and 1.0).
|
||||
|
||||
.. note::
|
||||
|
||||
For object's with custom :meth:`__hash__` methods, note that :func:`hash`
|
||||
truncates the return value based on the bit width of the host machine.
|
||||
See :meth:`__hash__` for details.
|
||||
|
||||
.. function:: help([object])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue