Skip to content

Commit beb1c65

Browse files
[3.11] gh-113313: Note that slice support is not required for all sequences. (gh-113377) (gh-113383)
1 parent 4baa4b5 commit beb1c65

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
@@ -2782,9 +2782,9 @@ through the object's keys; for sequences, it should iterate through the values.
27822782
.. method:: object.__getitem__(self, key)
27832783

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

0 commit comments

Comments
 (0)