Skip to content

Commit b0ce2db

Browse files
authored
GH-97950: Use new-style index directive ('operator') (#104156)
1 parent 33ca322 commit b0ce2db

File tree

3 files changed

+54
-54
lines changed

3 files changed

+54
-54
lines changed

Doc/library/stdtypes.rst

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ objects considered false:
6161
``range(0)``
6262

6363
.. index::
64-
operator: or
65-
operator: and
64+
pair: operator; or
65+
pair: operator; and
6666
single: False
6767
single: True
6868

@@ -95,9 +95,9 @@ These are the Boolean operations, ordered by ascending priority:
9595
+-------------+---------------------------------+-------+
9696

9797
.. index::
98-
operator: and
99-
operator: or
100-
operator: not
98+
pair: operator; and
99+
pair: operator; or
100+
pair: operator; not
101101

102102
Notes:
103103

@@ -122,14 +122,14 @@ Comparisons
122122
.. index::
123123
pair: chaining; comparisons
124124
pair: operator; comparison
125-
operator: ==
126-
operator: < (less)
127-
operator: <=
128-
operator: > (greater)
129-
operator: >=
130-
operator: !=
131-
operator: is
132-
operator: is not
125+
pair: operator; ==
126+
pair: operator; < (less)
127+
pair: operator; <=
128+
pair: operator; > (greater)
129+
pair: operator; >=
130+
pair: operator; !=
131+
pair: operator; is
132+
pair: operator; is not
133133

134134
There are eight comparison operations in Python. They all have the same
135135
priority (which is higher than that of the Boolean operations). Comparisons can
@@ -192,8 +192,8 @@ customized; also they can be applied to any two objects and never raise an
192192
exception.
193193

194194
.. index::
195-
operator: in
196-
operator: not in
195+
pair: operator; in
196+
pair: operator; not in
197197

198198
Two more operations with the same syntactic priority, :keyword:`in` and
199199
:keyword:`not in`, are supported by types that are :term:`iterable` or
@@ -253,11 +253,11 @@ and imaginary parts.
253253
single: operator; - (minus)
254254
single: - (minus); unary operator
255255
single: - (minus); binary operator
256-
operator: * (asterisk)
257-
operator: / (slash)
258-
operator: //
259-
operator: % (percent)
260-
operator: **
256+
pair: operator; * (asterisk)
257+
pair: operator; / (slash)
258+
pair: operator; //
259+
pair: operator; % (percent)
260+
pair: operator; **
261261

262262
Python fully supports mixed arithmetic: when a binary arithmetic operator has
263263
operands of different numeric types, the operand with the "narrower" type is
@@ -392,12 +392,12 @@ Bitwise Operations on Integer Types
392392
pair: bitwise; operations
393393
pair: shifting; operations
394394
pair: masking; operations
395-
operator: | (vertical bar)
396-
operator: ^ (caret)
397-
operator: & (ampersand)
398-
operator: <<
399-
operator: >>
400-
operator: ~ (tilde)
395+
pair: operator; | (vertical bar)
396+
pair: operator; ^ (caret)
397+
pair: operator; & (ampersand)
398+
pair: operator; <<
399+
pair: operator; >>
400+
pair: operator; ~ (tilde)
401401

402402
Bitwise operations only make sense for integers. The result of bitwise
403403
operations is calculated as though carried out in two's complement with an
@@ -952,8 +952,8 @@ operations have the same priority as the corresponding numeric operations. [3]_
952952
pair: repetition; operation
953953
pair: subscript; operation
954954
pair: slice; operation
955-
operator: in
956-
operator: not in
955+
pair: operator; in
956+
pair: operator; not in
957957
single: count() (sequence method)
958958
single: index() (sequence method)
959959

Doc/reference/expressions.rst

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ The power operator
11711171

11721172
.. index::
11731173
pair: power; operation
1174-
operator: **
1174+
pair: operator; **
11751175

11761176
The power operator binds more tightly than unary operators on its left; it binds
11771177
less tightly than unary operators on its right. The syntax is:
@@ -1232,7 +1232,7 @@ operation can be overridden with the :meth:`__pos__` special method.
12321232

12331233
.. index::
12341234
single: inversion
1235-
operator: ~ (tilde)
1235+
pair: operator; ~ (tilde)
12361236

12371237
The unary ``~`` (invert) operator yields the bitwise inversion of its integer
12381238
argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. It only
@@ -1267,7 +1267,7 @@ operators and one for additive operators:
12671267

12681268
.. index::
12691269
single: multiplication
1270-
operator: * (asterisk)
1270+
pair: operator; * (asterisk)
12711271

12721272
The ``*`` (multiplication) operator yields the product of its arguments. The
12731273
arguments must either both be numbers, or one argument must be an integer and
@@ -1280,7 +1280,7 @@ This operation can be customized using the special :meth:`__mul__` and
12801280

12811281
.. index::
12821282
single: matrix multiplication
1283-
operator: @ (at)
1283+
pair: operator; @ (at)
12841284

12851285
The ``@`` (at) operator is intended to be used for matrix multiplication. No
12861286
builtin Python types implement this operator.
@@ -1290,8 +1290,8 @@ builtin Python types implement this operator.
12901290
.. index::
12911291
exception: ZeroDivisionError
12921292
single: division
1293-
operator: / (slash)
1294-
operator: //
1293+
pair: operator; / (slash)
1294+
pair: operator; //
12951295

12961296
The ``/`` (division) and ``//`` (floor division) operators yield the quotient of
12971297
their arguments. The numeric arguments are first converted to a common type.
@@ -1305,7 +1305,7 @@ This operation can be customized using the special :meth:`__truediv__` and
13051305

13061306
.. index::
13071307
single: modulo
1308-
operator: % (percent)
1308+
pair: operator; % (percent)
13091309

13101310
The ``%`` (modulo) operator yields the remainder from the division of the first
13111311
argument by the second. The numeric arguments are first converted to a common
@@ -1363,8 +1363,8 @@ Shifting operations
13631363

13641364
.. index::
13651365
pair: shifting; operation
1366-
operator: <<
1367-
operator: >>
1366+
pair: operator; <<
1367+
pair: operator; >>
13681368

13691369
The shifting operations have lower priority than the arithmetic operations:
13701370

@@ -1399,7 +1399,7 @@ Each of the three bitwise operations has a different priority level:
13991399
14001400
.. index::
14011401
pair: bitwise; and
1402-
operator: & (ampersand)
1402+
pair: operator; & (ampersand)
14031403

14041404
The ``&`` operator yields the bitwise AND of its arguments, which must be
14051405
integers or one of them must be a custom object overriding :meth:`__and__` or
@@ -1408,7 +1408,7 @@ integers or one of them must be a custom object overriding :meth:`__and__` or
14081408
.. index::
14091409
pair: bitwise; xor
14101410
pair: exclusive; or
1411-
operator: ^ (caret)
1411+
pair: operator; ^ (caret)
14121412

14131413
The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which
14141414
must be integers or one of them must be a custom object overriding :meth:`__xor__` or
@@ -1417,7 +1417,7 @@ must be integers or one of them must be a custom object overriding :meth:`__xor_
14171417
.. index::
14181418
pair: bitwise; or
14191419
pair: inclusive; or
1420-
operator: | (vertical bar)
1420+
pair: operator; | (vertical bar)
14211421

14221422
The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which
14231423
must be integers or one of them must be a custom object overriding :meth:`__or__` or
@@ -1432,12 +1432,12 @@ Comparisons
14321432
.. index::
14331433
single: comparison
14341434
pair: C; language
1435-
operator: < (less)
1436-
operator: > (greater)
1437-
operator: <=
1438-
operator: >=
1439-
operator: ==
1440-
operator: !=
1435+
pair: operator; < (less)
1436+
pair: operator; > (greater)
1437+
pair: operator; <=
1438+
pair: operator; >=
1439+
pair: operator; ==
1440+
pair: operator; !=
14411441

14421442
Unlike C, all comparison operations in Python have the same priority, which is
14431443
lower than that of any arithmetic, shifting or bitwise operation. Also unlike
@@ -1669,17 +1669,17 @@ raises the :exc:`IndexError` exception. (If any other exception is raised, it i
16691669
if :keyword:`in` raised that exception).
16701670

16711671
.. index::
1672-
operator: in
1673-
operator: not in
1672+
pair: operator; in
1673+
pair: operator; not in
16741674
pair: membership; test
16751675
object: sequence
16761676

16771677
The operator :keyword:`not in` is defined to have the inverse truth value of
16781678
:keyword:`in`.
16791679

16801680
.. index::
1681-
operator: is
1682-
operator: is not
1681+
pair: operator; is
1682+
pair: operator; is not
16831683
pair: identity; test
16841684

16851685

@@ -1719,17 +1719,17 @@ control flow statements, the following values are interpreted as false:
17191719
other values are interpreted as true. User-defined objects can customize their
17201720
truth value by providing a :meth:`__bool__` method.
17211721

1722-
.. index:: operator: not
1722+
.. index:: pair: operator; not
17231723

17241724
The operator :keyword:`not` yields ``True`` if its argument is false, ``False``
17251725
otherwise.
17261726

1727-
.. index:: operator: and
1727+
.. index:: pair: operator; and
17281728

17291729
The expression ``x and y`` first evaluates *x*; if *x* is false, its value is
17301730
returned; otherwise, *y* is evaluated and the resulting value is returned.
17311731

1732-
.. index:: operator: or
1732+
.. index:: pair: operator; or
17331733

17341734
The expression ``x or y`` first evaluates *x*; if *x* is true, its value is
17351735
returned; otherwise, *y* is evaluated and the resulting value is returned.

Doc/tools/extensions/pyspecific.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def patch_pairindextypes(app) -> None:
691691

692692
pairindextypes.pop('module', None)
693693
pairindextypes.pop('keyword', None)
694-
# pairindextypes.pop('operator', None)
694+
pairindextypes.pop('operator', None)
695695
# pairindextypes.pop('object', None)
696696
# pairindextypes.pop('exception', None)
697697
# pairindextypes.pop('statement', None)

0 commit comments

Comments
 (0)