Skip to content

Commit

Permalink
Rephrase following feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Gouvernathor authored Jan 2, 2024
1 parent 5746dcc commit 71182cd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1613,11 +1613,9 @@ Basic customization
the left operand's method has priority. Virtual subclassing is
not considered.

When no method returns any value other than NotImplemented, comparisons raise
a :exc:`TypeError`. However, the ``==`` and ``!=`` operators will not raise an
exception in that case, and will instead fall back to ``is`` and ``is not``,
respectively. That way, even though ``object().__eq__(object())`` returns
NotImplemented, ``object() == object()`` returns False.
When no appropriate method returns any value other than ``NotImplemented``, the
``==`` and ``!=`` operators will fall back to ``is`` and ``is not``, respectively.
The other comparison operators raise a :exc:`TypeError` in that case.

.. method:: object.__hash__(self)

Expand Down

0 comments on commit 71182cd

Please sign in to comment.