diff options
author | Martin Panter <vadmium+py@gmail.com> | 2017-01-29 10:00:23 +0000 |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2017-01-29 10:00:23 +0000 |
commit | c360ad44ef4815cb1ebceaf392fcac56426b53aa (patch) | |
tree | 6a06bcd21e6da5bea3ae9e4b5daf8e0e8ab0b11d | |
parent | d09b3dc8acfefb00348f5456d7adba57ff823fdc (diff) | |
download | cpython-c360ad44ef4815cb1ebceaf392fcac56426b53aa.tar.gz |
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 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. |