8000 gh-72971: Clarify the special no-TypeError behavior for equality by Gouvernathor · Pull Request #110729 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-72971: Clarify the special no-TypeError behavior for equality #110729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 3, 2024
Merged
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
5 changes: 4 additions & 1 deletion Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1812,12 +1812,15 @@ Basic customization
rather, :meth:`__lt__` and :meth:`__gt__` are each other's reflection,
:meth:`__le__` and :meth:`__ge__` are each other's reflection, and
:meth:`__eq__` and :meth:`__ne__` are their own reflection.
If the operands are of different types, and right operand's type is
If the operands are of different types, and the right operand's type is
a direct or indirect subclass of the left operand's type,
the reflected method of the right operand has priority, otherwise
the left operand's method has priority. Virtual subclassing is
not considered.

When no appropriate method returns any value other than :data:`NotImplemented`, the
``==`` and ``!=`` operators will fall back to ``is`` and ``is not``, respectively.

.. method:: object.__hash__(self)

.. index::
Expand Down
0