@@ -1211,7 +1211,8 @@ Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`.
1211
1211
Raising a negative number to a fractional power results in a :class: `complex `
1212
1212
number. (In earlier versions it raised a :exc: `ValueError `.)
1213
1213
1214
- This operation can be customized using the special :meth: `~object.__pow__ ` method.
1214
+ This operation can be customized using the special :meth: `~object.__pow__ ` and
1215
+ :meth: `~object.__rpow__ ` methods.
1215
1216
1216
1217
.. _unary :
1217
1218
@@ -1299,6 +1300,9 @@ This operation can be customized using the special :meth:`~object.__mul__` and
1299
1300
The ``@ `` (at) operator is intended to be used for matrix multiplication. No
1300
1301
builtin Python types implement this operator.
1301
1302
1303
+ This operation can be customized using the special :meth: `~object.__matmul__ ` and
1304
+ :meth: `~object.__rmatmul__ ` methods.
1305
+
1302
1306
.. versionadded :: 3.5
1303
1307
1304
1308
.. index ::
@@ -1314,8 +1318,10 @@ integer; the result is that of mathematical division with the 'floor' function
1314
1318
applied to the result. Division by zero raises the :exc: `ZeroDivisionError `
1315
1319
exception.
1316
1320
1317
- This operation can be customized using the special :meth: `~object.__truediv__ ` and
1318
- :meth: `~object.__floordiv__ ` methods.
1321
+ The division operation can be customized using the special :meth: `~object.__truediv__ `
1322
+ and :meth: `~object.__rtruediv__ ` methods.
1323
+ The floor division operation can be customized using the special
1324
+ :meth: `~object.__floordiv__ ` and :meth: `~object.__rfloordiv__ ` methods.
1319
1325
1320
1326
.. index ::
1321
1327
single: modulo
@@ -1340,7 +1346,8 @@ also overloaded by string objects to perform old-style string formatting (also
1340
1346
known as interpolation). The syntax for string formatting is described in the
1341
1347
Python Library Reference, section :ref: `old-string-formatting `.
1342
1348
1343
- The *modulo * operation can be customized using the special :meth: `~object.__mod__ ` method.
1349
+ The *modulo * operation can be customized using the special :meth: `~object.__mod__ `
1350
+ and :meth: `~object.__rmod__ ` methods.
1344
1351
1345
1352
The floor division operator, the modulo operator, and the :func: `divmod `
1346
1353
function are not defined for complex numbers. Instead, convert to a floating
@@ -1367,7 +1374,8 @@ This operation can be customized using the special :meth:`~object.__add__` and
1367
1374
The ``- `` (subtraction) operator yields the difference of its arguments. The
1368
1375
numeric arguments are first converted to a common type.
1369
1376
1370
- This operation can be customized using the special :meth: `~object.__sub__ ` method.
1377
+ This operation can be customized using the special :meth: `~object.__sub__ ` and
1378
+ :meth: `~object.__rsub__ ` methods.
1371
1379
1372
1380
1373
1381
.. _shifting :
@@ -1388,8 +1396,10 @@ The shifting operations have lower priority than the arithmetic operations:
1388
1396
These operators accept integers as arguments. They shift the first argument to
1389
1397
the left or right by the number of bits given by the second argument.
1390
1398
1391
- This operation can be customized using the special :meth: `~object.__lshift__ ` and
1392
- :meth: `~object.__rshift__ ` methods.
1399
+ The left shift operation can be customized using the special :meth: `~object.__lshift__ `
1400
+ and :meth: `~object.__rlshift__ ` methods.
1401
+ The right shift operation can be customized using the special :meth: `~object.__rshift__ `
1402
+ and :meth: `~object.__rrshift__ ` methods.
1393
1403
1394
1404
.. index :: pair: exception; ValueError
1395
1405
0 commit comments