@@ -1204,7 +1204,8 @@ Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`.
1204
1204
Raising a negative number to a fractional power results in a :class: `complex `
1205
1205
number. (In earlier versions it raised a :exc: `ValueError `.)
1206
1206
1207
- This operation can be customized using the special :meth: `~object.__pow__ ` method.
1207
+ This operation can be customized using the special :meth: `~object.__pow__ ` and
1208
+ :meth: `~object.__rpow__ ` methods.
1208
1209
1209
1210
.. _unary :
1210
1211
@@ -1292,6 +1293,9 @@ This operation can be customized using the special :meth:`~object.__mul__` and
1292
1293
The ``@ `` (at) operator is intended to be used for matrix multiplication. No
1293
1294
builtin Python types implement this operator.
1294
1295
1296
+ This operation can be customized using the special :meth: `~object.__matmul__ ` and
1297
+ :meth: `~object.__rmatmul__ ` methods.
1298
+
1295
1299
.. versionadded :: 3.5
1296
1300
1297
1301
.. index ::
@@ -1307,8 +1311,10 @@ integer; the result is that of mathematical division with the 'floor' function
1307
1311
applied to the result. Division by zero raises the :exc: `ZeroDivisionError `
1308
1312
exception.
1309
1313
1310
- This operation can be customized using the special :meth: `~object.__truediv__ ` and
1311
- :meth: `~object.__floordiv__ ` methods.
1314
+ The division operation can be customized using the special :meth: `~object.__truediv__ `
1315
+ and :meth: `~object.__rtruediv__ ` methods.
1316
+ The floor division operation can be customized using the special
1317
+ :meth: `~object.__floordiv__ ` and :meth: `~object.__rfloordiv__ ` methods.
1312
1318
1313
1319
.. index ::
1314
1320
single: modulo
@@ -1333,7 +1339,8 @@ also overloaded by string objects to perform old-style string formatting (also
1333
1339
known as interpolation). The syntax for string formatting is described in the
1334
1340
Python Library Reference, section :ref: `old-string-formatting `.
1335
1341
1336
- The *modulo * operation can be customized using the special :meth: `~object.__mod__ ` method.
1342
+ The *modulo * operation can be customized using the special :meth: `~object.__mod__ `
1343
+ and :meth: `~object.__rmod__ ` methods.
1337
1344
1338
1345
The floor division operator, the modulo operator, and the :func: `divmod `
1339
1346
function are not defined for complex numbers. Instead, convert to a floating
@@ -1360,7 +1367,8 @@ This operation can be customized using the special :meth:`~object.__add__` and
1360
1367
The ``- `` (subtraction) operator yields the difference of its arguments. The
1361
1368
numeric arguments are first converted to a common type.
1362
1369
1363
- This operation can be customized using the special :meth: `~object.__sub__ ` method.
1370
+ This operation can be customized using the special :meth: `~object.__sub__ ` and
1371
+ :meth: `~object.__rsub__ ` methods.
1364
1372
1365
1373
1366
1374
.. _shifting :
@@ -1381,8 +1389,10 @@ The shifting operations have lower priority than the arithmetic operations:
1381
1389
These operators accept integers as arguments. They shift the first argument to
1382
1390
the left or right by the number of bits given by the second argument.
1383
1391
1384
- This operation can be customized using the special :meth: `~object.__lshift__ ` and
1385
- :meth: `~object.__rshift__ ` methods.
1392
+ The left shift operation can be customized using the special :meth: `~object.__lshift__ `
1393
+ and :meth: `~object.__rlshift__ ` methods.
1394
+ The right shift operation can be customized using the special :meth: `~object.__rshift__ `
1395
+ and :meth: `~object.__rrshift__ ` methods.
1386
1396
1387
1397
.. index :: pair: exception; ValueError
1388
1398
0 commit comments