aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2017-01-29 10:07:26 +0000
committerMartin Panter <vadmium+py@gmail.com>2017-01-29 10:07:26 +0000
commit2be98894059a13529d5696afb8fcb33408d2e9dd (patch)
treeff85c59cf05f889748a66372007eb216b6045fac /Doc/reference/expressions.rst
parentIssue 29310: Document typing.NamedTuple default argument syntax (diff)
parentIssue #12067: Recommend that hash and equality be consistent (diff)
downloadcpython-2be98894059a13529d5696afb8fcb33408d2e9dd.tar.gz
cpython-2be98894059a13529d5696afb8fcb33408d2e9dd.tar.bz2
cpython-2be98894059a13529d5696afb8fcb33408d2e9dd.zip
Issues #12067: Merge hash recommendation from 3.5
Diffstat (limited to 'Doc/reference/expressions.rst')
-rw-r--r--Doc/reference/expressions.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index b37df92d59a..3a4b80557ca 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -1415,6 +1415,10 @@ some consistency rules, if possible:
sequences, but not to sets or mappings). See also the
:func:`~functools.total_ordering` decorator.
+* The :func:`hash` result should be consistent with equality.
+ Objects that are equal should either have the same hash value,
+ or be marked as unhashable.
+
Python does not enforce these consistency rules. In fact, the not-a-number
values are an example for not following these rules.