- Issue #18440: Clarify that hash() can truncate the value returned from an

object's custom `__hash__()` method.
This commit is contained in:
Barry Warsaw 2013-07-15 14:47:29 -04:00
parent 48830035e5
commit 224a599c0c
3 changed files with 27 additions and 8 deletions

View file

@ -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])