From f085df17458e29b13ece5372217b6740eec2e3da Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Wed, 22 Apr 2026 14:06:15 +0800 Subject: [PATCH 1/2] add `frozendict` to 'hashed collections' --- Doc/reference/datamodel.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 1e53c0e0e6f971..bd75d0bd142b6e 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -2210,12 +2210,12 @@ Basic customization pair: built-in function; hash Called by built-in function :func:`hash` and for operations on members of - hashed collections including :class:`set`, :class:`frozenset`, and - :class:`dict`. The ``__hash__()`` method should return an integer. The only required - property is that objects which compare equal have the same hash value; it is - advised to mix together the hash values of the components of the object that - also play a part in comparison of objects by packing them into a tuple and - hashing the tuple. Example:: + hashed collections including :class:`set`, :class:`frozenset`, :class:`dict` + and :class:`frozendict`. The ``__hash__()`` method should return an integer. + The only required property is that objects which compare equal have the same + hash value; it is advised to mix together the hash values of the components + of the object that also play a part in comparison of objects by packing them + into a tuple and hashing the tuple. Example:: def __hash__(self): return hash((self.name, self.nick, self.color)) From 6130ede1e0b6a49705d602a8ce4659ee0fccbab5 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 23 Apr 2026 07:52:52 +0800 Subject: [PATCH 2/2] Readd Oxford comma MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartosz Sławecki --- Doc/reference/datamodel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index bd75d0bd142b6e..b22b59f529939c 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -2210,7 +2210,7 @@ Basic customization pair: built-in function; hash Called by built-in function :func:`hash` and for operations on members of - hashed collections including :class:`set`, :class:`frozenset`, :class:`dict` + hashed collections including :class:`set`, :class:`frozenset`, :class:`dict`, and :class:`frozendict`. The ``__hash__()`` method should return an integer. The only required property is that objects which compare equal have the same hash value; it is advised to mix together the hash values of the components