https://github.com/python/cpython/commit/e3762114e514f7790e9b4cf3a7b9478f2f306901
commit: e3762114e514f7790e9b4cf3a7b9478f2f306901
branch: main
author: Jonathan Dung <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-06-08T12:39:41+01:00
summary:
Mention `frozendict` in `object.__hash__()` documentation (#148867)
files:
M Doc/reference/datamodel.rst
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 8d1704a448e6394..2a961a062780f46 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2230,12 +2230,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))
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]