summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-05-04 09:27:04 (GMT)
committerGitHub <noreply@github.com>2023-05-04 09:27:04 (GMT)
commit693ef48df1891a6a30fca6c6db500c7cd08671df (patch)
tree3e48d06a9d3267b0d7767dcec41d5a000908c0b1 /Doc/reference
parenta9fcf01ed9591e9e68da9a25edc43fca676c276d (diff)
downloadcpython-693ef48df1891a6a30fca6c6db500c7cd08671df.zip
cpython-693ef48df1891a6a30fca6c6db500c7cd08671df.tar.gz
cpython-693ef48df1891a6a30fca6c6db500c7cd08671df.tar.bz2
[3.11] GH-97950: Use new-style index directive ('operator') (GH-104156) (#104157)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/expressions.rst50
1 files changed, 25 insertions, 25 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 0dcd7d8..46e8c7c 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -1160,7 +1160,7 @@ The power operator
.. index::
pair: power; operation
- operator: **
+ pair: operator; **
The power operator binds more tightly than unary operators on its left; it binds
less tightly than unary operators on its right. The syntax is:
@@ -1221,7 +1221,7 @@ operation can be overridden with the :meth:`__pos__` special method.
.. index::
single: inversion
- operator: ~ (tilde)
+ pair: operator; ~ (tilde)
The unary ``~`` (invert) operator yields the bitwise inversion of its integer
argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. It only
@@ -1256,7 +1256,7 @@ operators and one for additive operators:
.. index::
single: multiplication
- operator: * (asterisk)
+ pair: operator; * (asterisk)
The ``*`` (multiplication) operator yields the product of its arguments. The
arguments must either both be numbers, or one argument must be an integer and
@@ -1269,7 +1269,7 @@ This operation can be customized using the special :meth:`__mul__` and
.. index::
single: matrix multiplication
- operator: @ (at)
+ pair: operator; @ (at)
The ``@`` (at) operator is intended to be used for matrix multiplication. No
builtin Python types implement this operator.
@@ -1279,8 +1279,8 @@ builtin Python types implement this operator.
.. index::
exception: ZeroDivisionError
single: division
- operator: / (slash)
- operator: //
+ pair: operator; / (slash)
+ pair: operator; //
The ``/`` (division) and ``//`` (floor division) operators yield the quotient of
their arguments. The numeric arguments are first converted to a common type.
@@ -1294,7 +1294,7 @@ This operation can be customized using the special :meth:`__truediv__` and
.. index::
single: modulo
- operator: % (percent)
+ pair: operator; % (percent)
The ``%`` (modulo) operator yields the remainder from the division of the first
argument by the second. The numeric arguments are first converted to a common
@@ -1352,8 +1352,8 @@ Shifting operations
.. index::
pair: shifting; operation
- operator: <<
- operator: >>
+ pair: operator; <<
+ pair: operator; >>
The shifting operations have lower priority than the arithmetic operations:
@@ -1388,7 +1388,7 @@ Each of the three bitwise operations has a different priority level:
.. index::
pair: bitwise; and
- operator: & (ampersand)
+ pair: operator; & (ampersand)
The ``&`` operator yields the bitwise AND of its arguments, which must be
integers or one of them must be a custom object overriding :meth:`__and__` or
@@ -1397,7 +1397,7 @@ integers or one of them must be a custom object overriding :meth:`__and__` or
.. index::
pair: bitwise; xor
pair: exclusive; or
- operator: ^ (caret)
+ pair: operator; ^ (caret)
The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which
must be integers or one of them must be a custom object overriding :meth:`__xor__` or
@@ -1406,7 +1406,7 @@ must be integers or one of them must be a custom object overriding :meth:`__xor_
.. index::
pair: bitwise; or
pair: inclusive; or
- operator: | (vertical bar)
+ pair: operator; | (vertical bar)
The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which
must be integers or one of them must be a custom object overriding :meth:`__or__` or
@@ -1421,12 +1421,12 @@ Comparisons
.. index::
single: comparison
pair: C; language
- operator: < (less)
- operator: > (greater)
- operator: <=
- operator: >=
- operator: ==
- operator: !=
+ pair: operator; < (less)
+ pair: operator; > (greater)
+ pair: operator; <=
+ pair: operator; >=
+ pair: operator; ==
+ pair: operator; !=
Unlike C, all comparison operations in Python have the same priority, which is
lower than that of any arithmetic, shifting or bitwise operation. Also unlike
@@ -1658,8 +1658,8 @@ raises the :exc:`IndexError` exception. (If any other exception is raised, it i
if :keyword:`in` raised that exception).
.. index::
- operator: in
- operator: not in
+ pair: operator; in
+ pair: operator; not in
pair: membership; test
object: sequence
@@ -1667,8 +1667,8 @@ The operator :keyword:`not in` is defined to have the inverse truth value of
:keyword:`in`.
.. index::
- operator: is
- operator: is not
+ pair: operator; is
+ pair: operator; is not
pair: identity; test
@@ -1708,17 +1708,17 @@ control flow statements, the following values are interpreted as false:
other values are interpreted as true. User-defined objects can customize their
truth value by providing a :meth:`__bool__` method.
-.. index:: operator: not
+.. index:: pair: operator; not
The operator :keyword:`not` yields ``True`` if its argument is false, ``False``
otherwise.
-.. index:: operator: and
+.. index:: pair: operator; and
The expression ``x and y`` first evaluates *x*; if *x* is false, its value is
returned; otherwise, *y* is evaluated and the resulting value is returned.
-.. index:: operator: or
+.. index:: pair: operator; or
The expression ``x or y`` first evaluates *x*; if *x* is true, its value is
returned; otherwise, *y* is evaluated and the resulting value is returned.