Skip to content

Commit 2750ee6

Browse files
committed
gh-145591: Move slicing note to subscription methods section
1 parent 1d091a3 commit 2750ee6

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Doc/reference/datamodel.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,21 +3223,6 @@ through the object's keys; for sequences, it should iterate through the values.
32233223
.. versionadded:: 3.4
32243224

32253225

3226-
.. index:: pair: object; slice
3227-
3228-
.. note::
3229-
3230-
Slicing is done exclusively with the following three methods. A call like ::
3231-
3232-
a[1:2] = b
3233-
3234-
is translated to ::
3235-
3236-
a[slice(1, 2, None)] = b
3237-
3238-
and so forth. Missing slice items are always filled in with ``None``.
3239-
3240-
32413226
.. method:: object.__getitem__(self, subscript)
32423227

32433228
Called to implement *subscription*, that is, ``self[subscript]``.
@@ -3260,6 +3245,21 @@ through the object's keys; for sequences, it should iterate through the values.
32603245
should raise an :exc:`LookupError` or one of its subclasses
32613246
(:exc:`IndexError` for sequences; :exc:`KeyError` for mappings).
32623247

3248+
.. index:: pair: object; slice
3249+
3250+
.. note::
3251+
3252+
Slicing is done exclusively with the following three methods.
3253+
A call like ::
3254+
3255+
a[1:2] = b
3256+
3257+
is translated to ::
3258+
3259+
a[slice(1, 2, None)] = b
3260+
3261+
and so forth. Missing slice items are always filled in with ``None``.
3262+
32633263
.. note::
32643264

32653265
The sequence iteration protocol (used, for example, in :keyword:`for`

0 commit comments

Comments
 (0)