Skip to content

[3.11] gh-113313: Note that slice support is not required for all sequences. (gh-113377) #113383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2782,9 +2782,9 @@ through the object's keys; for sequences, it should iterate through the values.
.. method:: object.__getitem__(self, key)

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