Skip to content

Commit 170c84e

Browse files
committed
Move methods after footnotes
1 parent 7d6f0fd commit 170c84e

File tree

1 file changed

+50
-42
lines changed

1 file changed

+50
-42
lines changed

Doc/library/stdtypes.rst

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,36 +1030,6 @@ operations have the same priority as the corresponding numeric operations. [3]_
10301030
| ``max(s)`` | largest item of *s* | |
10311031
+--------------------------+--------------------------------+----------+
10321032

1033-
.. method:: list.count(value, /)
1034-
range.count(value, /)
1035-
tuple.count(value, /)
1036-
:no-contents-entry:
1037-
:no-index-entry:
1038-
:no-typesetting:
1039-
.. method:: sequence.count(value, /)
1040-
1041-
Return the total number of occurrences of *value* in *sequence*.
1042-
1043-
.. method:: list.index(value[, start[, stop])
1044-
range.index(value[, start[, stop])
1045-
tuple.index(value[, start[, stop])
1046-
:no-contents-entry:
1047-
:no-index-entry:
1048-
:no-typesetting:
1049-
.. method:: sequence.index(value[, start[, stop])
1050-
1051-
Return the index of the first occurrence of *value* in *sequence*.
1052-
1053-
Raises :exc:`ValueError` if *value* is not found in *sequence*.
1054-
1055-
The *start* or *stop* arguments allow for efficient searching
1056-
of subsections of the sequence, beginning at *start* and ending at *stop*.
1057-
This is roughly equivalent to ``start + sequence[start:stop].index(value)``,
1058-
only without copying any data.
1059-
1060-
.. caution::
1061-
Not all sequence types support passing the *start* and *stop* arguments.
1062-
10631033
Sequences of the same type also support comparisons. In particular, tuples
10641034
and lists are compared lexicographically by comparing corresponding elements.
10651035
This means that to compare equal, every element must compare equal and the
@@ -1166,6 +1136,41 @@ Notes:
11661136
(8)
11671137
An :exc:`IndexError` is raised if *i* is outside the sequence range.
11681138

1139+
.. rubric:: Sequence Methods
1140+
1141+
Sequence types also support the following methods:
1142+
1143+
.. method:: list.count(value, /)
1144+
range.count(value, /)
1145+
tuple.count(value, /)
1146+
:no-contents-entry:
1147+
:no-index-entry:
1148+
:no-typesetting:
1149+
.. method:: sequence.count(value, /)
1150+
1151+
Return the total number of occurrences of *value* in *sequence*.
1152+
1153+
.. method:: list.index(value[, start[, stop])
1154+
range.index(value[, start[, stop])
1155+
tuple.index(value[, start[, stop])
1156+
:no-contents-entry:
1157+
:no-index-entry:
1158+
:no-typesetting:
1159+
.. method:: sequence.index(value[, start[, stop])
1160+
1161+
Return the index of the first occurrence of *value* in *sequence*.
1162+
1163+
Raises :exc:`ValueError` if *value* is not found in *sequence*.
1164+
1165+
The *start* or *stop* arguments allow for efficient searching
1166+
of subsections of the sequence, beginning at *start* and ending at *stop*.
1167+
This is roughly equivalent to ``start + sequence[start:stop].index(value)``,
1168+
only without copying any data.
1169+
1170+
.. caution::
1171+
Not all sequence types support passing the *start* and *stop* arguments.
1172+
1173+
11691174

11701175
.. _typesseq-immutable:
11711176

@@ -1247,6 +1252,21 @@ accepts integers that meet the value restriction ``0 <= x <= 255``).
12471252
| | repeated *n* times | |
12481253
+------------------------------+--------------------------------+---------------------+
12491254

1255+
Notes:
1256+
1257+
(1)
1258+
If *k* is not equal to ``1``, *t* must have the same length as the slice it is replacing.
1259+
1260+
(2)
1261+
The value *n* is an integer, or an object implementing
1262+
:meth:`~object.__index__`. Zero and negative values of *n* clear
1263+
the sequence. Items in the sequence are not copied; they are referenced
1264+
multiple times, as explained for ``s * n`` under :ref:`typesseq-common`.
1265+
1266+
.. rubric:: Mutable Sequence Methods
1267+
1268+
Mutable sequence types also support the following methods:
1269+
12501270
.. method:: bytearray.append(value, /)
12511271
list.append(value, /)
12521272
:no-contents-entry:
@@ -1339,18 +1359,6 @@ accepts integers that meet the value restriction ``0 <= x <= 255``).
13391359
To remind users that it operates by side-effect, it returns ``None``.
13401360

13411361

1342-
Notes:
1343-
1344-
(1)
1345-
If *k* is not equal to ``1``, *t* must have the same length as the slice it is replacing.
1346-
1347-
(2)
1348-
The value *n* is an integer, or an object implementing
1349-
:meth:`~object.__index__`. Zero and negative values of *n* clear
1350-
the sequence. Items in the sequence are not copied; they are referenced
1351-
multiple times, as explained for ``s * n`` under :ref:`typesseq-common`.
1352-
1353-
13541362
.. _typesseq-list:
13551363

13561364
Lists

0 commit comments

Comments
 (0)