Skip to content

Commit 43a63cc

Browse files
committed
Add note about s[i]
1 parent 5507eff commit 43a63cc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Doc/library/stdtypes.rst

Lines changed: 5 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,10 @@ 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+
If the sequence is empty or *i* is outside the sequence range, :exc:`IndexError`
1155+
will be raised.
1156+
11531157

11541158
.. _typesseq-immutable:
11551159

0 commit comments

Comments
 (0)