diff options
author | Georg Brandl <georg@python.org> | 2006-04-01 07:23:08 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-04-01 07:23:08 (GMT) |
commit | e071b001cacb81202fba0d20c03f45a9bd60d78d (patch) | |
tree | 96807c3e162d0cc6e4edccf8577659d095318742 /Doc/ref/ref3.tex | |
parent | 23fd3d49e9750f01730ced166e3880afb126ca19 (diff) | |
download | cpython-e071b001cacb81202fba0d20c03f45a9bd60d78d.zip cpython-e071b001cacb81202fba0d20c03f45a9bd60d78d.tar.gz cpython-e071b001cacb81202fba0d20c03f45a9bd60d78d.tar.bz2 |
bug #1462278: small fix in documentation of __op__ vs __rop__ methods
Diffstat (limited to 'Doc/ref/ref3.tex')
-rw-r--r-- | Doc/ref/ref3.tex | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex index 2dd70e0..964013f 100644 --- a/Doc/ref/ref3.tex +++ b/Doc/ref/ref3.tex @@ -2057,14 +2057,15 @@ exception is raised. But see the following exception: \item 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 -instance of a proper subclass of that type or class, the right -operand's \method{__rop__()} method is tried \emph{before} the left -operand's \method{__op__()} method. This is done so that a subclass can -completely override binary operators. Otherwise, the left operand's -__op__ method would always accept the right operand: when an instance -of a given class is expected, an instance of a subclass of that class -is always acceptable. +a built-in type or a new-style class, and the right operand is an instance +of a proper subclass of that type or class and overrides the base's +\method{__rop__()} method, the right operand's \method{__rop__()} method +is tried \emph{before} the left operand's \method{__op__()} method. + +This is done so that a subclass can completely override binary operators. +Otherwise, the left operand's \method{__op__()} method would always +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 |