Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Loading