]> granicus.if.org Git - python/commitdiff
Issue #12067: Recommend that hash and equality be consistent
authorMartin Panter <vadmium+py@gmail.com>
Sun, 29 Jan 2017 10:00:23 +0000 (10:00 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sun, 29 Jan 2017 10:00:23 +0000 (10:00 +0000)
Doc/reference/expressions.rst

index 9792399ba74bc252e66cfd661b0c1dbcbbd4d023..ea89486128c68f25d4d36b75fddf9182596e05f3 100644 (file)
@@ -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.