Skip to content

Conversation

@adorilson
Copy link
Contributor

@adorilson adorilson commented Jan 15, 2026

WIP to #106318

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


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


.. doctest::

>>> 'spam, spam, spam'.rindex('eggs')
Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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
Member

Choose a reason for hiding this comment

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

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
Contributor Author

Choose a reason for hiding this comment

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

Done here.

Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a new PR: #144408

Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All done.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner
Copy link
Member

vstinner commented Feb 3, 2026

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 vstinner enabled auto-merge (squash) February 3, 2026 13:23
@vstinner vstinner added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Feb 3, 2026
@vstinner vstinner merged commit 45d00a0 into python:main Feb 3, 2026
33 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Feb 3, 2026
@miss-islington-app
Copy link

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
Copy link

bedevere-app bot commented Feb 3, 2026

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

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Feb 3, 2026
@bedevere-app
Copy link

bedevere-app bot commented Feb 3, 2026

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

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and 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
Copy link
Member

vstinner commented Feb 3, 2026

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>
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