diff options
author | Martin Panter <vadmium+py@gmail.com> | 2017-01-29 10:00:23 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2017-01-29 10:00:23 (GMT) |
commit | 8dbb0ca573436dcc780ae3fc00941f928f02b708 (patch) | |
tree | 88a4d06c38b923279213bd42e5d7ccca2af555cd | |
parent | 3ac504289a93079f2f99d43b51c82153f7b3260a (diff) | |
download | cpython-8dbb0ca573436dcc780ae3fc00941f928f02b708.zip cpython-8dbb0ca573436dcc780ae3fc00941f928f02b708.tar.gz cpython-8dbb0ca573436dcc780ae3fc00941f928f02b708.tar.bz2 |
Issue #12067: Recommend that hash and equality be consistent
-rw-r--r-- | Doc/reference/expressions.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 9792399..ea89486 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. |