Skip to content

Commit feec759

Browse files
Describe omitted slice parameters.
1 parent c2f19ad commit feec759

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/reference/datamodel.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ Some sequences also support "extended slicing" with a third *step* parameter:
325325
``i = start + n*step`` and ``0 <= n``, such that ``start <= i < stop`` for
326326
``0 <= step``, and ``stop < i <= start`` for ``step < 0``.
327327

328+
Slicing parameters can be omitted:
329+
* When *step* is omitted, it defaults to 1.
330+
* When *start* is omitted, the selection starts from the 1st index depending on
331+
the *step* direction (index 0 for ``0 < step``, subscript -1 for ``step < 0``).
332+
* When *end* is omitted, the selection ends when there isn't any element left.
333+
328334
Sequences are distinguished according to their mutability:
329335

330336

0 commit comments

Comments
 (0)