[Python-checkins] cpython (3.5): Issue #12067: Recommend that hash and equality be consistent
martin.panter
python-checkins at python.org
Sun Jan 29 05:34:25 EST 2017
https://hg.python.org/cpython/rev/8c9a86aa222e
changeset: 106329:8c9a86aa222e
branch: 3.5
parent: 106320:91b949dc1984
user: Martin Panter <vadmium+py at gmail.com>
date: Sun Jan 29 10:00:23 2017 +0000
summary:
Issue #12067: Recommend that hash and equality be consistent
files:
Doc/reference/expressions.rst | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -1255,6 +1255,10 @@
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.
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list