Skip to content

Commit 07a64ed

Browse files
rhettingeraisk
authored andcommitted
pythongh-113313: Note that slice support is not required for all sequences. (pythongh-113377)
1 parent be4526c commit 07a64ed

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

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

0 commit comments

Comments
 (0)