8000 [3.11] GH-97950: Use new-style index directive ('operator') (GH-10415… · python/cpython@693ef48 · GitHub
[go: up one dir, main page]

Skip to content

Commit 693ef48

Browse files
[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>
1 parent a9fcf01 commit 693ef48

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
@@ -913,8 +913,8 @@ operations have the same priority as the corresponding numeric operations. [3]_
913913
pair: repetition; operation
914914
pair: subscript; operation
915915
pair: slice; operation
916-
operator: in
917-
operator: not in
916+
pair: operator; in
917+
pair: operator; not in
918918
single: count() (sequence method)
919919
single: index() (sequence method)
920920

Doc/reference/expressions.rst

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

11611161
.. index::
11621162
pair: power; operation
1163-
operator: **
1163+
pair: operator; **
11641164

11651165
The power operator binds more tightly than unary operators on its left; it binds
11661166
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.
12211221

12221222
.. index::
12231223
single: inversion
1224-
operator: ~ (tilde)
1224+
pair: operator; ~ (tilde)
12251225

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

12571257
.. index::
12581258
single: multiplication
1259-
operator: * (asterisk)
1259+
pair: operator; * (asterisk)
12601260

12611261
The ``*`` (multiplication) operator yields the product of its arguments. The
12621262
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
12691269

12701270
.. index::
12711271
single: matrix multiplication
1272-
operator: @ (at)
1272+
pair: operator; @ (at)
12731273

12741274
The ``@`` (at) operator is intended to be used for matrix multiplication. No
12751275
builtin Python types implement this operator.
@@ -1279,8 +1279,8 @@ builtin Python types implement this operator.
12791279
.. index::
12801280
exception: ZeroDivisionError
12811281
single: division
1282-
operator: / (slash)
1283-
operator: //
1282+
pair: operator; / (slash)
1283+
pair: operator; //
12841284

12851285
The ``/`` (division) and ``//`` (floor division) operators yield the quotient of
12861286
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
12941294

12951295
.. index::
12961296
single: modulo
1297-
operator: % (percent)
1297+
pair: operator; % (percent)
12981298

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

13531353
.. index::
13541354
pair: shifting; operation
1355-
operator: <<
1356-
operator: >>
1355+
pair: operator; <<
1356+
pair: operator; >>
13571357

13581358
The shifting operations have lower priority than the arithmetic operations:
13591359

@@ -1388,7 +1388,7 @@ Each of the three bitwise operations has a different priority level:
13881388
13891389
.. index::
13901390
pair: bitwise; and
1391-
operator: & (ampersand)
1391+
pair: operator; & (ampersand)
13921392

13931393
The ``&`` operator yields the bitwise AND of its arguments, which must be
13941394
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
13971397
.. index::
13981398
pair: bitwise; xor
13991399
pair: exclusive; or
1400-
operator: ^ (caret)
1400+
pair: operator; ^ (caret)
14011401

14021402
The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which
14031403
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_
14061406
.. index::
14071407
pair: bitwise; or
14081408
pair: inclusive; or
1409-
operator: | (vertical bar)
1409+
pair: operator; | (vertical bar)
14101410

14111411
The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which
14121412
must be integers or one of them must be a custom object overriding :meth:`__or__` or
@@ -1421,12 +1421,12 @@ Comparisons
14211421
.. index::
14221422
single: comparison
14231423
pair: C; language
1424-
operator: < (less)
1425-
operator: > (greater)
1426-
operator: <=
1427-
operator: >=
1428-
operator: ==
1429-
operator: !=
1424+
pair: operator; < (less)
1425+
pair: operator; > (greater)
1426+
pair: operator; <=
1427+
pair: operator; >=
1428+
pair: operator; ==
1429+
pair: operator; !=
14301430

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

16601660
.. index::
1661-
operator: in
1662-
operator: not in
1661+
pair: operator; in
1662+
pair: operator; not in
16631663
pair: membership; test
16641664
object: sequence
16651665

16661666
The operator :keyword:`not in` is defined to have the inverse truth value of
16671667
:keyword:`in`.
16681668

16691669
.. index::
1670-
operator: is
1671-
operator: is not
1670+
pair: operator; is
1671+
pair: operator; is not
16721672
pair: identity; test
16731673

16741674

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

1711-
.. index:: operator: not
1711+
.. index:: pair: operator; not
17121712

17131713
The operator :keyword:`not` yields ``True`` if its argument is false, ``False``
17141714
otherwise.
17151715

1716-
.. index:: operator: and
1716+
.. index:: pair: operator; and
17171717

17181718
The expression ``x and y`` first evaluates *x*; if *x* is false, its value is
17191719
returned; otherwise, *y* is evaluated and the resulting value is returned.
17201720

1721-
.. index:: operator: or
1721+
.. index:: pair: operator; or
17221722

17231723
The expression ``x or y`` first evaluates *x*; if *x* is true, its value is
17241724
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
@@ -696,7 +696,7 @@ def patch_pairindextypes(app) -> None:
696696

697697
pairindextypes.pop('module', None)
698698
pairindextypes.pop('keyword', None)
699-
# pairindextypes.pop('operator', None)
699+
pairindextypes.pop('operator', None)
700700
# pairindextypes.pop('object', None)
701701
# pairindextypes.pop('exception', None)
702702
# pairindextypes.pop('statement', None)

0 commit comments

Comments
 (0)
0