mirror of
https://github.com/python/cpython.git
synced 2025-11-22 03:28:32 +00:00
bug #1462278: small fix in documentation of __op__ vs __rop__ methods
This commit is contained in:
parent
23fd3d49e9
commit
e071b001ca
1 changed files with 9 additions and 8 deletions
|
|
@ -2057,14 +2057,15 @@ exception is raised. But see the following exception:
|
||||||
\item
|
\item
|
||||||
|
|
||||||
Exception to the previous item: if the left operand is an instance of
|
Exception to the previous item: if the left operand is an instance of
|
||||||
a built-in type or a new-style class, and the right operand is an
|
a built-in type or a new-style class, and the right operand is an instance
|
||||||
instance of a proper subclass of that type or class, the right
|
of a proper subclass of that type or class and overrides the base's
|
||||||
operand's \method{__rop__()} method is tried \emph{before} the left
|
\method{__rop__()} method, the right operand's \method{__rop__()} method
|
||||||
operand's \method{__op__()} method. This is done so that a subclass can
|
is tried \emph{before} the left operand's \method{__op__()} method.
|
||||||
completely override binary operators. Otherwise, the left operand's
|
|
||||||
__op__ method would always accept the right operand: when an instance
|
This is done so that a subclass can completely override binary operators.
|
||||||
of a given class is expected, an instance of a subclass of that class
|
Otherwise, the left operand's \method{__op__()} method would always
|
||||||
is always acceptable.
|
accept the right operand: when an instance of a given class is expected,
|
||||||
|
an instance of a subclass of that class is always acceptable.
|
||||||
|
|
||||||
\item
|
\item
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue