Skip to content

Commit 158e516

Browse files
authored
gh-134976: document the exception type that can be raised by s[i] (#134977)
1 parent 1cb7163 commit 158e516

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ operations have the same priority as the corresponding numeric operations. [3]_
10181018
| ``s * n`` or | equivalent to adding *s* to | (2)(7) |
10191019
| ``n * s`` | itself *n* times | |
10201020
+--------------------------+--------------------------------+----------+
1021-
| ``s[i]`` | *i*\ th item of *s*, origin 0 | \(3) |
1021+
| ``s[i]`` | *i*\ th item of *s*, origin 0 | (3)(9) |
10221022
+--------------------------+--------------------------------+----------+
10231023
| ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) |
10241024
+--------------------------+--------------------------------+----------+
@@ -1150,6 +1150,9 @@ Notes:
11501150
without copying any data and with the returned index being relative to
11511151
the start of the sequence rather than the start of the slice.
11521152

1153+
(9)
1154+
An :exc:`IndexError` is raised if *i* is outside the sequence range.
1155+
11531156

11541157
.. _typesseq-immutable:
11551158

0 commit comments

Comments
 (0)