From c360ad44ef4815cb1ebceaf392fcac56426b53aa Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Sun, 29 Jan 2017 10:00:23 +0000 Subject: Issue #12067: Recommend that hash and equality be consistent --- Doc/reference/expressions.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 9792399ba7..ea89486128 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1255,6 +1255,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. -- cgit v1.2.1