Skip to content

Commit 08d3b5d

Browse files
[3.12] gh-113313: Note that slice support is not required for all sequences. (gh-113377) (gh-113382)
1 parent c38ebb4 commit 08d3b5d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/reference/datamodel.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2803,9 +2803,9 @@ through the object's keys; for sequences, it should iterate through the values.
28032803
.. method:: object.__getitem__(self, key)
28042804

28052805
Called to implement evaluation of ``self[key]``. For :term:`sequence` types,
2806-
the accepted keys should be integers and slice objects. Note that the
2807-
special interpretation of negative indexes (if the class wishes to emulate a
2808-
:term:`sequence` type) is up to the :meth:`__getitem__` method. If *key* is
2806+
the accepted keys should be integers. Optionally, they may support
2807+
:class:`slice` objects as well. Negative index support is also optional.
2808+
If *key* is
28092809
of an inappropriate type, :exc:`TypeError` may be raised; if *key* is a value
28102810
outside the set of indexes for the sequence (after any special
28112811
interpretation of negative values), :exc:`IndexError` should be raised. For

0 commit comments

Comments
 (0)