diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-05-27 17:21:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-27 17:21:31 (GMT) |
commit | cc1c582f6fe450ce1c7de849137039e9b5fab8eb (patch) | |
tree | 6e0a3c49e1f42c2f0db9a2ce7798d185e4f87aa1 | |
parent | 02db696732c031d9a0265dc9bbf4f5b1fad042b3 (diff) | |
download | cpython-cc1c582f6fe450ce1c7de849137039e9b5fab8eb.zip cpython-cc1c582f6fe450ce1c7de849137039e9b5fab8eb.tar.gz cpython-cc1c582f6fe450ce1c7de849137039e9b5fab8eb.tar.bz2 |
bpo-37051: Refine note on what objects are hashable (GH-13587)
-rw-r--r-- | Doc/glossary.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/glossary.rst b/Doc/glossary.rst index d3ce365..177df54 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -512,8 +512,10 @@ Glossary Hashability makes an object usable as a dictionary key and a set member, because these data structures use the hash value internally. - All of Python's immutable built-in objects are hashable; mutable - containers (such as lists or dictionaries) are not. Objects which are + Most of Python's immutable built-in objects are hashable; mutable + containers (such as lists or dictionaries) are not; immutable + containers (such as tuples and frozensets) are only hashable if + their elements are hashable. Objects which are instances of user-defined classes are hashable by default. They all compare unequal (except with themselves), and their hash value is derived from their :func:`id`. |