summaryrefslogtreecommitdiffstats
path: root/Doc/library/functions.rst
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2013-07-15 19:21:41 (GMT)
committerBarry Warsaw <barry@python.org>2013-07-15 19:21:41 (GMT)
commit4958f714bde917c8dc1b087932f44608b4634452 (patch)
treedcb12b27e4966cc9682c7fe10c63ee4a7e6e0b3f /Doc/library/functions.rst
parent0fedb37c47971b75e644b05e5a467dad2a77620b (diff)
parent224a599c0c0755a3a2602a9f0051a6707c8e1162 (diff)
downloadcpython-4958f714bde917c8dc1b087932f44608b4634452.zip
cpython-4958f714bde917c8dc1b087932f44608b4634452.tar.gz
cpython-4958f714bde917c8dc1b087932f44608b4634452.tar.bz2
- Issue #18440: Clarify that `hash()` can truncate the value returned from an
object's custom `__hash__()` method.
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r--Doc/library/functions.rst13
1 files changed, 9 insertions, 4 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 3d239ec..a37d496 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -587,11 +587,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])