Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8dbb0ca

Browse files
committed
Issue #12067: Recommend that hash and equality be consistent
1 parent 3ac5042 commit 8dbb0ca

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Doc/reference/expressions.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,10 @@ some consistency rules, if possible:
12551255
sequences, but not to sets or mappings). See also the
12561256
:func:`~functools.total_ordering` decorator.
12571257

1258+
* The :func:`hash` result should be consistent with equality.
1259+
Objects that are equal should either have the same hash value,
1260+
or be marked as unhashable.
1261+
12581262
Python does not enforce these consistency rules. In fact, the not-a-number
12591263
values are an example for not following these rules.
12601264

0 commit comments

Comments
 (0)