-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Add notes about s[i]
in Common Sequence Operations
#134976
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
Comments
I'm surprised that there is nothing about |
I believe that while negative indexes are implemented for (most?) builtins, this is not necessarily the case for all sequences. |
Note (3) still says:
So the common sequence operations assume that negative indices should be supported by arbitrary sequences. |
…[i]` (pythonGH-134977) (cherry picked from commit 158e516) Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
…[i]` (pythonGH-134977) (cherry picked from commit 158e516) Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
Thank you! |
Uh oh!
There was an error while loading. Please reload this page.
Documentation
s[i]
len(s) + i
orlen(s) + j
is substituted. But note that-0
is still0
.We can add a note: If the sequence is empty or i is outside the sequence range,
IndexError
will be raised.Linked PRs
s[i]
#134977s[i]
(GH-134977) #135258s[i]
(GH-134977) #135259The text was updated successfully, but these errors were encountered: