[Python-checkins] bpo-37051: Refine note on what objects are hashable (GH-13587) (GH-13595)
Raymond Hettinger
webhook-mailer at python.org
Mon May 27 13:43:26 EDT 2019
https://github.com/python/cpython/commit/e8318f31f35dc851684c094b268e4a85d7f357c9
commit: e8318f31f35dc851684c094b268e4a85d7f357c9
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Raymond Hettinger <rhettinger at users.noreply.github.com>
date: 2019-05-27T10:43:18-07:00
summary:
bpo-37051: Refine note on what objects are hashable (GH-13587) (GH-13595)
(cherry picked from commit cc1c582f6fe450ce1c7de849137039e9b5fab8eb)
Co-authored-by: Raymond Hettinger <rhettinger at users.noreply.github.com>
files:
M Doc/glossary.rst
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
index b6ab28617d14..f7f35cbb67d2 100644
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -508,8 +508,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`.
More information about the Python-checkins
mailing list