From: Raymond Hettinger Date: Mon, 27 May 2019 17:21:31 +0000 (-0700) Subject: bpo-37051: Refine note on what objects are hashable (GH-13587) X-Git-Tag: v3.8.0b1~188 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc1c582f6fe450ce1c7de849137039e9b5fab8eb;p=python bpo-37051: Refine note on what objects are hashable (GH-13587) --- diff --git a/Doc/glossary.rst b/Doc/glossary.rst index d3ce365255..177df54ef2 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`.