From: Martin Panter Date: Sun, 29 Jan 2017 10:00:23 +0000 (+0000) Subject: Issue #12067: Recommend that hash and equality be consistent X-Git-Tag: v3.6.1rc1~133^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8dbb0ca573436dcc780ae3fc00941f928f02b708;p=thirdparty%2FPython%2Fcpython.git Issue #12067: Recommend that hash and equality be consistent --- diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 9792399ba74b..ea89486128c6 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.