FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-106318: Add example for str.rindex() method by adorilson · Pull Request #143887 · python/cpython · GitHub

Repository navigation

gh-106318: Add example for str.rindex() method - #143887

Merged
vstinner merged 5 commits into
python:mainfrom
adorilson:106318.rindex
Feb 3, 2026
Merged

vstinner merged 5 commits into
python:mainfrom
adorilson:106318.rindex

Conversation

adorilson commented Jan 15, 2026 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

WIP to #106318

#106318: Add examples for str.rindex() method


📚 Documentation preview 📚: https://cpython-previews--143887.org.readthedocs.build/

Comment thread Doc/library/stdtypes.rst

.. doctest::

>>> 'spam, spam, spam'.rindex('eggs')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you add a successful example, like looking for spam?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sure.

But I did it this way to be in line with str.index, which doesn't have a successful example.

Should I add it there as well?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

But I did it this way to be in line with str.index, which doesn't have a successful example. Should I add it there as well?

Yes, I suggest to also add a successful example in str.index().

Try to use the same input string for both examples.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Done here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You didn't add a successful example to str.index().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It is a new PR: #144408

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It doesn't deserve a whole new PR. Please change it in this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

All done.

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

vstinner commented Feb 3, 2026

Copy link
Copy Markdown
Member

Oh. "Tests / All required checks pass" CI failed with:

Error: The template is not valid. .github/workflows/build.yml (Line: 723, Col: 24): Error reading JToken from JsonReader. Path '', line 0, position 0.

Let me try to update the branch.

vstinner enabled auto-merge (squash) February 3, 2026 13:23
vstinner added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Feb 3, 2026
vstinner merged commit 45d00a0 into python:main Feb 3, 2026
33 checks passed
github-project-automation Bot moved this from Todo to Done in Docs PRs Feb 3, 2026

Copy link
Copy Markdown

Thanks @adorilson for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 3, 2026
(cherry picked from commit 45d00a0)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 3, 2026
(cherry picked from commit 45d00a0)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>

bedevere-app Bot commented Feb 3, 2026

Copy link
Copy Markdown

GH-144421 is a backport of this pull request to the 3.14 branch.

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Feb 3, 2026

bedevere-app Bot commented Feb 3, 2026

Copy link
Copy Markdown

GH-144422 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 only security fixes label Feb 3, 2026
vstinner added a commit that referenced this pull request Feb 3, 2026
…144421)

gh-106318: Add examples for str.rindex() method (GH-143887)
(cherry picked from commit 45d00a0)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this pull request Feb 3, 2026
…144422)

gh-106318: Add examples for str.rindex() method (GH-143887)
(cherry picked from commit 45d00a0)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>

vstinner commented Feb 3, 2026

Copy link
Copy Markdown
Member

Merged, thanks.

Aniketsy pushed a commit to Aniketsy/cpython that referenced this pull request Feb 3, 2026
Co-authored-by: Victor Stinner <vstinner@python.org>
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
Co-authored-by: Victor Stinner <vstinner@python.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL