@@ -1970,6 +1970,7 @@ left undefined.
19701970.. method :: object.__add__(self, other)
19711971 object.__sub__(self, other)
19721972 object.__mul__(self, other)
1973+ object.__matmul__(self, other)
19731974 object.__truediv__(self, other)
19741975 object.__floordiv__(self, other)
19751976 object.__mod__(self, other)
@@ -1986,15 +1987,16 @@ left undefined.
19861987 builtin: pow
19871988 builtin: pow
19881989
1989- These methods are called to implement the binary arithmetic operations (``+ ``,
1990- ``- ``, ``* ``, ``/ ``, ``// ``, ``% ``, :func: `divmod `, :func: `pow `, ``** ``, ``<< ``,
1991- ``>> ``, ``& ``, ``^ ``, ``| ``). For instance, to evaluate the expression
1992- ``x + y ``, where *x * is an instance of a class that has an :meth: `__add__ `
1993- method, ``x.__add__(y) `` is called. The :meth: `__divmod__ ` method should be the
1994- equivalent to using :meth: `__floordiv__ ` and :meth: `__mod__ `; it should not be
1995- related to :meth: `__truediv__ `. Note that :meth: `__pow__ ` should be defined
1996- to accept an optional third argument if the ternary version of the built-in
1997- :func: `pow ` function is to be supported.
1990+ These methods are called to implement the binary arithmetic operations
1991+ (``+ ``, ``- ``, ``* ``, ``@ ``, ``/ ``, ``// ``, ``% ``, :func: `divmod `,
1992+ :func: `pow `, ``** ``, ``<< ``, ``>> ``, ``& ``, ``^ ``, ``| ``). For instance, to
1993+ evaluate the expression ``x + y ``, where *x * is an instance of a class that
1994+ has an :meth: `__add__ ` method, ``x.__add__(y) `` is called. The
1995+ :meth: `__divmod__ ` method should be the equivalent to using
1996+ :meth: `__floordiv__ ` and :meth: `__mod__ `; it should not be related to
1997+ :meth: `__truediv__ `. Note that :meth: `__pow__ ` should be defined to accept
1998+ an optional third argument if the ternary version of the built-in :func: `pow `
1999+ function is to be supported.
19982000
19992001 If one of those methods does not support the operation with the supplied
20002002 arguments, it should return ``NotImplemented ``.
@@ -2003,6 +2005,7 @@ left undefined.
20032005.. method :: object.__radd__(self, other)
20042006 object.__rsub__(self, other)
20052007 object.__rmul__(self, other)
2008+ object.__rmatmul__(self, other)
20062009 object.__rtruediv__(self, other)
20072010 object.__rfloordiv__(self, other)
20082011 object.__rmod__(self, other)
@@ -2018,14 +2021,14 @@ left undefined.
20182021 builtin: divmod
20192022 builtin: pow
20202023
2021- These methods are called to implement the binary arithmetic operations (`` + ``,
2022- `` - ``, ``* ``, ``/ ``, ``// ``, ``% ``, :func: ` divmod ` , :func: `pow `, `` ** ` `,
2023- `` << ``, ``>> ``, ``& ``, ``^ ``, ``| ``) with reflected (swapped) operands.
2024- These functions are only called if the left operand does not support the
2025- corresponding operation and the operands are of different types. [ # ]_ For
2026- instance, to evaluate the expression ``x - y ``, where *y * is an instance of
2027- a class that has an :meth: `__rsub__ ` method, ``y.__rsub__(x) `` is called if
2028- ``x.__sub__(y) `` returns *NotImplemented *.
2024+ These methods are called to implement the binary arithmetic operations
2025+ (`` + ``, `` - ``, ``* ``, ``@ ``, ``/ ``, ``// ``, `` % `` , :func: `divmod `,
2026+ :func: ` pow `, `` ** ``, `` << ``, ``>> ``, ``& ``, ``^ ``, ``| ``) with reflected
2027+ (swapped) operands. These functions are only called if the left operand does
2028+ not support the corresponding operation and the operands are of different
2029+ types. [ # ]_ For instance, to evaluate the expression ``x - y ``, where *y * is
2030+ an instance of a class that has an :meth: `__rsub__ ` method, ``y.__rsub__(x) ``
2031+ is called if ``x.__sub__(y) `` returns *NotImplemented *.
20292032
20302033 .. index :: builtin: pow
20312034
@@ -2043,6 +2046,7 @@ left undefined.
20432046.. method :: object.__iadd__(self, other)
20442047 object.__isub__(self, other)
20452048 object.__imul__(self, other)
2049+ object.__imatmul__(self, other)
20462050 object.__itruediv__(self, other)
20472051 object.__ifloordiv__(self, other)
20482052 object.__imod__(self, other)
@@ -2054,17 +2058,17 @@ left undefined.
20542058 object.__ior__(self, other)
20552059
20562060 These methods are called to implement the augmented arithmetic assignments
2057- (``+= ``, ``-= ``, ``*= ``, ``/ = ``, ``// = ``, ``% = ``, ``** = ``, ``<< = ``, ``>> = ``,
2058- ``&= ``, ``^= ``, ``|= ``). These methods should attempt to do the operation
2059- in-place (modifying *self *) and return the result (which could be, but does
2060- not have to be, *self *). If a specific method is not defined, the augmented
2061- assignment falls back to the normal methods. For instance, if *x * is an
2062- instance of a class with an :meth: `__iadd__ ` method, ``x += y `` is equivalent
2063- to ``x = x.__iadd__(y) `` . Otherwise, ``x.__add__(y) `` and `` y.__radd__(x) ``
2064- are considered, as with the evaluation of ``x + y ``. In certain situations,
2065- augmented assignment can result in unexpected errors (see
2066- :ref: `faq-augmented-assignment-tuple-error `), but this behavior is in
2067- fact part of the data model.
2061+ (``+= ``, ``-= ``, ``*= ``, ``@ = ``, ``/= ``, ``// = ``, ``% = ``, ``** = ``, ``<< = ``,
2062+ ``>>= ``, `` &= ``, ``^= ``, ``|= ``). These methods should attempt to do the
2063+ operation in-place (modifying *self *) and return the result (which could be,
2064+ but does not have to be, *self *). If a specific method is not defined, the
2065+ augmented assignment falls back to the normal methods. For instance, if *x *
2066+ is an instance of a class with an :meth: `__iadd__ ` method, ``x += y `` is
2067+ equivalent to ``x = x.__iadd__(y) `` . Otherwise, ``x.__add__(y) `` and
2068+ `` y.__radd__(x) `` are considered, as with the evaluation of ``x + y ``. In
2069+ certain situations, augmented assignment can result in unexpected errors (see
2070+ :ref: `faq-augmented-assignment-tuple-error `), but this behavior is in fact
2071+ part of the data model.
20682072
20692073
20702074.. method :: object.__neg__(self)
0 commit comments