changeset: 106329:8c9a86aa222e branch: 3.5 parent: 106320:91b949dc1984 user: Martin Panter date: Sun Jan 29 10:00:23 2017 +0000 files: Doc/reference/expressions.rst description: Issue #12067: Recommend that hash and equality be consistent diff -r 91b949dc1984 -r 8c9a86aa222e Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst Fri Jan 27 12:41:27 2017 +0000 +++ b/Doc/reference/expressions.rst Sun Jan 29 10:00:23 2017 +0000 @@ -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.