Skip to content

Commit f997921

Browse files
[3.12] gh-101100: Fix Sphinx warnings in reference/expressions.rst (GH-114194) (#114436)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent d705582 commit f997921

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

Doc/reference/expressions.rst

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ but does not affect the semantics.
994994

995995
The primary must evaluate to a callable object (user-defined functions, built-in
996996
functions, methods of built-in objects, class objects, methods of class
997-
instances, and all objects having a :meth:`__call__` method are callable). All
997+
instances, and all objects having a :meth:`~object.__call__` method are callable). All
998998
argument expressions are evaluated before the call is attempted. Please refer
999999
to section :ref:`function` for the syntax of formal :term:`parameter` lists.
10001000

@@ -1152,7 +1152,7 @@ a class instance:
11521152
pair: instance; call
11531153
single: __call__() (object method)
11541154

1155-
The class must define a :meth:`__call__` method; the effect is then the same as
1155+
The class must define a :meth:`~object.__call__` method; the effect is then the same as
11561156
if that method was called.
11571157

11581158

@@ -1204,7 +1204,7 @@ Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`.
12041204
Raising a negative number to a fractional power results in a :class:`complex`
12051205
number. (In earlier versions it raised a :exc:`ValueError`.)
12061206

1207-
This operation can be customized using the special :meth:`__pow__` method.
1207+
This operation can be customized using the special :meth:`~object.__pow__` method.
12081208

12091209
.. _unary:
12101210

@@ -1227,15 +1227,15 @@ All unary arithmetic and bitwise operations have the same priority:
12271227
single: - (minus); unary operator
12281228

12291229
The unary ``-`` (minus) operator yields the negation of its numeric argument; the
1230-
operation can be overridden with the :meth:`__neg__` special method.
1230+
operation can be overridden with the :meth:`~object.__neg__` special method.
12311231

12321232
.. index::
12331233
single: plus
12341234
single: operator; + (plus)
12351235
single: + (plus); unary operator
12361236

12371237
The unary ``+`` (plus) operator yields its numeric argument unchanged; the
1238-
operation can be overridden with the :meth:`__pos__` special method.
1238+
operation can be overridden with the :meth:`~object.__pos__` special method.
12391239

12401240
.. index::
12411241
single: inversion
@@ -1244,7 +1244,7 @@ operation can be overridden with the :meth:`__pos__` special method.
12441244
The unary ``~`` (invert) operator yields the bitwise inversion of its integer
12451245
argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. It only
12461246
applies to integral numbers or to custom objects that override the
1247-
:meth:`__invert__` special method.
1247+
:meth:`~object.__invert__` special method.
12481248

12491249

12501250

@@ -1282,8 +1282,8 @@ the other must be a sequence. In the former case, the numbers are converted to a
12821282
common type and then multiplied together. In the latter case, sequence
12831283
repetition is performed; a negative repetition factor yields an empty sequence.
12841284

1285-
This operation can be customized using the special :meth:`__mul__` and
1286-
:meth:`__rmul__` methods.
1285+
This operation can be customized using the special :meth:`~object.__mul__` and
1286+
:meth:`~object.__rmul__` methods.
12871287

12881288
.. index::
12891289
single: matrix multiplication
@@ -1307,8 +1307,8 @@ integer; the result is that of mathematical division with the 'floor' function
13071307
applied to the result. Division by zero raises the :exc:`ZeroDivisionError`
13081308
exception.
13091309

1310-
This operation can be customized using the special :meth:`__truediv__` and
1311-
:meth:`__floordiv__` methods.
1310+
This operation can be customized using the special :meth:`~object.__truediv__` and
1311+
:meth:`~object.__floordiv__` methods.
13121312

13131313
.. index::
13141314
single: modulo
@@ -1333,7 +1333,7 @@ also overloaded by string objects to perform old-style string formatting (also
13331333
known as interpolation). The syntax for string formatting is described in the
13341334
Python Library Reference, section :ref:`old-string-formatting`.
13351335

1336-
The *modulo* operation can be customized using the special :meth:`__mod__` method.
1336+
The *modulo* operation can be customized using the special :meth:`~object.__mod__` method.
13371337

13381338
The floor division operator, the modulo operator, and the :func:`divmod`
13391339
function are not defined for complex numbers. Instead, convert to a floating
@@ -1349,8 +1349,8 @@ must either both be numbers or both be sequences of the same type. In the
13491349
former case, the numbers are converted to a common type and then added together.
13501350
In the latter case, the sequences are concatenated.
13511351

1352-
This operation can be customized using the special :meth:`__add__` and
1353-
:meth:`__radd__` methods.
1352+
This operation can be customized using the special :meth:`~object.__add__` and
1353+
:meth:`~object.__radd__` methods.
13541354

13551355
.. index::
13561356
single: subtraction
@@ -1360,7 +1360,7 @@ This operation can be customized using the special :meth:`__add__` and
13601360
The ``-`` (subtraction) operator yields the difference of its arguments. The
13611361
numeric arguments are first converted to a common type.
13621362

1363-
This operation can be customized using the special :meth:`__sub__` method.
1363+
This operation can be customized using the special :meth:`~object.__sub__` method.
13641364

13651365

13661366
.. _shifting:
@@ -1381,8 +1381,8 @@ The shifting operations have lower priority than the arithmetic operations:
13811381
These operators accept integers as arguments. They shift the first argument to
13821382
the left or right by the number of bits given by the second argument.
13831383

1384-
This operation can be customized using the special :meth:`__lshift__` and
1385-
:meth:`__rshift__` methods.
1384+
This operation can be customized using the special :meth:`~object.__lshift__` and
1385+
:meth:`~object.__rshift__` methods.
13861386

13871387
.. index:: pair: exception; ValueError
13881388

@@ -1409,26 +1409,26 @@ Each of the three bitwise operations has a different priority level:
14091409
pair: operator; & (ampersand)
14101410

14111411
The ``&`` operator yields the bitwise AND of its arguments, which must be
1412-
integers or one of them must be a custom object overriding :meth:`__and__` or
1413-
:meth:`__rand__` special methods.
1412+
integers or one of them must be a custom object overriding :meth:`~object.__and__` or
1413+
:meth:`~object.__rand__` special methods.
14141414

14151415
.. index::
14161416
pair: bitwise; xor
14171417
pair: exclusive; or
14181418
pair: operator; ^ (caret)
14191419

14201420
The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which
1421-
must be integers or one of them must be a custom object overriding :meth:`__xor__` or
1422-
:meth:`__rxor__` special methods.
1421+
must be integers or one of them must be a custom object overriding :meth:`~object.__xor__` or
1422+
:meth:`~object.__rxor__` special methods.
14231423

14241424
.. index::
14251425
pair: bitwise; or
14261426
pair: inclusive; or
14271427
pair: operator; | (vertical bar)
14281428

14291429
The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which
1430-
must be integers or one of them must be a custom object overriding :meth:`__or__` or
1431-
:meth:`__ror__` special methods.
1430+
must be integers or one of them must be a custom object overriding :meth:`~object.__or__` or
1431+
:meth:`~object.__ror__` special methods.
14321432

14331433

14341434
.. _comparisons:
@@ -1495,7 +1495,7 @@ comparison implementation.
14951495
Because all types are (direct or indirect) subtypes of :class:`object`, they
14961496
inherit the default comparison behavior from :class:`object`. Types can
14971497
customize their comparison behavior by implementing
1498-
:dfn:`rich comparison methods` like :meth:`__lt__`, described in
1498+
:dfn:`rich comparison methods` like :meth:`~object.__lt__`, described in
14991499
:ref:`customization`.
15001500

15011501
The default behavior for equality comparison (``==`` and ``!=``) is based on
@@ -1659,12 +1659,12 @@ substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty strings are
16591659
always considered to be a substring of any other string, so ``"" in "abc"`` will
16601660
return ``True``.
16611661

1662-
For user-defined classes which define the :meth:`__contains__` method, ``x in
1662+
For user-defined classes which define the :meth:`~object.__contains__` method, ``x in
16631663
y`` returns ``True`` if ``y.__contains__(x)`` returns a true value, and
16641664
``False`` otherwise.
16651665

1666-
For user-defined classes which do not define :meth:`__contains__` but do define
1667-
:meth:`__iter__`, ``x in y`` is ``True`` if some value ``z``, for which the
1666+
For user-defined classes which do not define :meth:`~object.__contains__` but do define
1667+
:meth:`~object.__iter__`, ``x in y`` is ``True`` if some value ``z``, for which the
16681668
expression ``x is z or x == z`` is true, is produced while iterating over ``y``.
16691669
If an exception is raised during the iteration, it is as if :keyword:`in` raised
16701670
that exception.

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ Doc/library/xmlrpc.server.rst
112112
Doc/library/zlib.rst
113113
Doc/reference/compound_stmts.rst
114114
Doc/reference/datamodel.rst
115-
Doc/reference/expressions.rst
116115
Doc/reference/import.rst
117116
Doc/tutorial/datastructures.rst
118117
Doc/using/windows.rst

0 commit comments

Comments
 (0)