Skip to content

Commit 598ea16

Browse files
committed
gh-143420: Clarify sequence behavior for slice indexes
This explain what happens when for negative start or stop arguments of big magnitude. Also reference sequence term in the :mod:`array` docs.
1 parent c99f766 commit 598ea16

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Doc/library/array.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
--------------
1010

1111
This module defines an object type which can compactly represent an array of
12-
basic values: characters, integers, floating-point numbers. Arrays are sequence
12+
basic values: characters, integers, floating-point numbers. Arrays are :term:`sequence`
1313
types and behave very much like lists, except that the type of objects stored in
1414
them is constrained. The type is specified at object creation time by using a
1515
:dfn:`type code`, which is a single character. The following type codes are

Doc/library/stdtypes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,8 @@ Notes:
10951095
(4)
10961096
The slice of *s* from *i* to *j* is defined as the sequence of items with index
10971097
*k* such that ``i <= k < j``. If *i* or *j* is greater than ``len(s)``, use
1098-
``len(s)``. If *i* is omitted or ``None``, use ``0``. If *j* is omitted or
1098+
``len(s)``. If *i* or *j* is less than ``-len(s)``, use ``0``.
1099+
If *i* is omitted or ``None``, use ``0``. If *j* is omitted or
10991100
``None``, use ``len(s)``. If *i* is greater than or equal to *j*, the slice is
11001101
empty.
11011102

0 commit comments

Comments
 (0)