@@ -984,7 +984,7 @@ but does not affect the semantics.
984
984
985
985
The primary must evaluate to a callable object (user-defined functions, built-in
986
986
functions, methods of built-in objects, class objects, methods of class
987
- instances, and all objects having a :meth: `__call__ ` method are callable). All
987
+ instances, and all objects having a :meth: `~object. __call__ ` method are callable). All
988
988
argument expressions are evaluated before the call is attempted. Please refer
989
989
to section :ref: `function ` for the syntax of formal :term: `parameter ` lists.
990
990
@@ -1142,7 +1142,7 @@ a class instance:
1142
1142
pair: instance; call
1143
1143
single: __call__() (object method)
1144
1144
1145
- The class must define a :meth: `__call__ ` method; the effect is then the same as
1145
+ The class must define a :meth: `~object. __call__ ` method; the effect is then the same as
1146
1146
if that method was called.
1147
1147
1148
1148
@@ -1194,7 +1194,7 @@ Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`.
1194
1194
Raising a negative number to a fractional power results in a :class: `complex `
1195
1195
number. (In earlier versions it raised a :exc: `ValueError `.)
1196
1196
1197
- This operation can be customized using the special :meth: `__pow__ ` method.
1197
+ This operation can be customized using the special :meth: `~object. __pow__ ` method.
1198
1198
1199
1199
.. _unary :
1200
1200
@@ -1217,15 +1217,15 @@ All unary arithmetic and bitwise operations have the same priority:
1217
1217
single: - (minus); unary operator
1218
1218
1219
1219
The unary ``- `` (minus) operator yields the negation of its numeric argument; the
1220
- operation can be overridden with the :meth: `__neg__ ` special method.
1220
+ operation can be overridden with the :meth: `~object. __neg__ ` special method.
1221
1221
1222
1222
.. index ::
1223
1223
single: plus
1224
1224
single: operator; + (plus)
1225
1225
single: + (plus); unary operator
1226
1226
1227
1227
The unary ``+ `` (plus) operator yields its numeric argument unchanged; the
1228
- operation can be overridden with the :meth: `__pos__ ` special method.
1228
+ operation can be overridden with the :meth: `~object. __pos__ ` special method.
1229
1229
1230
1230
.. index ::
1231
1231
single: inversion
@@ -1234,7 +1234,7 @@ operation can be overridden with the :meth:`__pos__` special method.
1234
1234
The unary ``~ `` (invert) operator yields the bitwise inversion of its integer
1235
1235
argument. The bitwise inversion of ``x `` is defined as ``-(x+1) ``. It only
1236
1236
applies to integral numbers or to custom objects that override the
1237
- :meth: `__invert__ ` special method.
1237
+ :meth: `~object. __invert__ ` special method.
1238
1238
1239
1239
1240
1240
@@ -1272,8 +1272,8 @@ the other must be a sequence. In the former case, the numbers are converted to a
1272
1272
common type and then multiplied together. In the latter case, sequence
1273
1273
repetition is performed; a negative repetition factor yields an empty sequence.
1274
1274
1275
- This operation can be customized using the special :meth: `__mul__ ` and
1276
- :meth: `__rmul__ ` methods.
1275
+ This operation can be customized using the special :meth: `~object. __mul__ ` and
1276
+ :meth: `~object. __rmul__ ` methods.
1277
1277
1278
1278
.. index ::
1279
1279
single: matrix multiplication
@@ -1297,8 +1297,8 @@ integer; the result is that of mathematical division with the 'floor' function
1297
1297
applied to the result. Division by zero raises the :exc: `ZeroDivisionError `
1298
1298
exception.
1299
1299
1300
- This operation can be customized using the special :meth: `__truediv__ ` and
1301
- :meth: `__floordiv__ ` methods.
1300
+ This operation can be customized using the special :meth: `~object. __truediv__ ` and
1301
+ :meth: `~object. __floordiv__ ` methods.
1302
1302
1303
1303
.. index ::
1304
1304
single: modulo
@@ -1323,7 +1323,7 @@ also overloaded by string objects to perform old-style string formatting (also
1323
1323
known as interpolation). The syntax for string formatting is described in the
1324
1324
Python Library Reference, section :ref: `old-string-formatting `.
1325
1325
1326
- The *modulo * operation can be customized using the special :meth: `__mod__ ` method.
1326
+ The *modulo * operation can be customized using the special :meth: `~object. __mod__ ` method.
1327
1327
1328
1328
The floor division operator, the modulo operator, and the :func: `divmod `
1329
1329
function are not defined for complex numbers. Instead, convert to a floating
@@ -1339,8 +1339,8 @@ must either both be numbers or both be sequences of the same type. In the
1339
1339
former case, the numbers are converted to a common type and then added together.
1340
1340
In the latter case, the sequences are concatenated.
1341
1341
1342
- This operation can be customized using the special :meth: `__add__ ` and
1343
- :meth: `__radd__ ` methods.
1342
+ This operation can be customized using the special :meth: `~object. __add__ ` and
1343
+ :meth: `~object. __radd__ ` methods.
1344
1344
1345
1345
.. index ::
1346
1346
single: subtraction
@@ -1350,7 +1350,7 @@ This operation can be customized using the special :meth:`__add__` and
1350
1350
The ``- `` (subtraction) operator yields the difference of its arguments. The
1351
1351
numeric arguments are first converted to a common type.
1352
1352
1353
- This operation can be customized using the special :meth: `__sub__ ` method.
1353
+ This operation can be customized using the special :meth: `~object. __sub__ ` method.
1354
1354
1355
1355
1356
1356
.. _shifting :
@@ -1371,8 +1371,8 @@ The shifting operations have lower priority than the arithmetic operations:
1371
1371
These operators accept integers as arguments. They shift the first argument to
1372
1372
the left or right by the number of bits given by the second argument.
1373
1373
1374
- This operation can be customized using the special :meth: `__lshift__ ` and
1375
- :meth: `__rshift__ ` methods.
1374
+ This operation can be customized using the special :meth: `~object. __lshift__ ` and
1375
+ :meth: `~object. __rshift__ ` methods.
1376
1376
1377
1377
.. index :: pair: exception; ValueError
1378
1378
@@ -1399,26 +1399,26 @@ Each of the three bitwise operations has a different priority level:
1399
1399
pair: operator; & (ampersand)
1400
1400
1401
1401
The ``& `` operator yields the bitwise AND of its arguments, which must be
1402
- integers or one of them must be a custom object overriding :meth: `__and__ ` or
1403
- :meth: `__rand__ ` special methods.
1402
+ integers or one of them must be a custom object overriding :meth: `~object. __and__ ` or
1403
+ :meth: `~object. __rand__ ` special methods.
1404
1404
1405
1405
.. index ::
1406
1406
pair: bitwise; xor
1407
1407
pair: exclusive; or
1408
1408
pair: operator; ^ (caret)
1409
1409
1410
1410
The ``^ `` operator yields the bitwise XOR (exclusive OR) of its arguments, which
1411
- must be integers or one of them must be a custom object overriding :meth: `__xor__ ` or
1412
- :meth: `__rxor__ ` special methods.
1411
+ must be integers or one of them must be a custom object overriding :meth: `~object. __xor__ ` or
1412
+ :meth: `~object. __rxor__ ` special methods.
1413
1413
1414
1414
.. index ::
1415
1415
pair: bitwise; or
1416
1416
pair: inclusive; or
1417
1417
pair: operator; | (vertical bar)
1418
1418
1419
1419
The ``| `` operator yields the bitwise (inclusive) OR of its arguments, which
1420
- must be integers or one of them must be a custom object overriding :meth: `__or__ ` or
1421
- :meth: `__ror__ ` special methods.
1420
+ must be integers or one of them must be a custom object overriding :meth: `~object. __or__ ` or
1421
+ :meth: `~object. __ror__ ` special methods.
1422
1422
1423
1423
1424
1424
.. _comparisons :
@@ -1485,7 +1485,7 @@ comparison implementation.
1485
1485
Because all types are (direct or indirect) subtypes of :class: `object `, they
1486
1486
inherit the default comparison behavior from :class: `object `. Types can
1487
1487
customize their comparison behavior by implementing
1488
- :dfn: `rich comparison methods ` like :meth: `__lt__ `, described in
1488
+ :dfn: `rich comparison methods ` like :meth: `~object. __lt__ `, described in
1489
1489
:ref: `customization `.
1490
1490
1491
1491
The default behavior for equality comparison (``== `` and ``!= ``) is based on
@@ -1649,12 +1649,12 @@ substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty strings are
1649
1649
always considered to be a substring of any other string, so ``"" in "abc" `` will
1650
1650
return ``True ``.
1651
1651
1652
- For user-defined classes which define the :meth: `__contains__ ` method, ``x in
1652
+ For user-defined classes which define the :meth: `~object. __contains__ ` method, ``x in
1653
1653
y `` returns ``True `` if ``y.__contains__(x) `` returns a true value, and
1654
1654
``False `` otherwise.
1655
1655
1656
- For user-defined classes which do not define :meth: `__contains__ ` but do define
1657
- :meth: `__iter__ `, ``x in y `` is ``True `` if some value ``z ``, for which the
1656
+ For user-defined classes which do not define :meth: `~object. __contains__ ` but do define
1657
+ :meth: `~object. __iter__ `, ``x in y `` is ``True `` if some value ``z ``, for which the
1658
1658
expression ``x is z or x == z `` is true, is produced while iterating over ``y ``.
1659
1659
If an exception is raised during the iteration, it is as if :keyword: `in ` raised
1660
1660
that exception.
0 commit comments