GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-106318: Add example for str.rindex() method by adorilson · Pull Request #143887 · python/cpython

Conversation

@adorilson

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

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

WIP to #106318

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

  • Issue: Add examples to docs for str methods #106318

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@adorilson
pythongh-106318: Add example for str.rindex() method
8661e67
@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Jan 15, 2026
@github-project-automation github-project-automation Bot added this to Docs PRs Jan 15, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Jan 15, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Jan 15, 2026
Add examples to docs for str methods #106318
Open
@bedevere-app bedevere-app Bot added the awaiting review label Jan 15, 2026
vstinner
vstinner reviewed Jan 19, 2026
View reviewed changes
Comment thread Doc/library/stdtypes.rst

.. doctest::

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

@vstinner vstinner Jan 19, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@adorilson adorilson Jan 31, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner Feb 2, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@adorilson adorilson Feb 2, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Done here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner Feb 2, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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().

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@adorilson adorilson Feb 2, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner Feb 3, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@adorilson adorilson Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

All done.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
adorilson added 3 commits February 2, 2026 21:36
@adorilson
pythongh-106318: Add a successful example for str.rindex() method
140d99b
@adorilson
pythongh-106318: Fix typo
08a4a43
@adorilson
pythongh-106318: Add a successful example for str.index() method
df2492e
@adorilson adorilson mentioned this pull request Feb 3, 2026
gh-106318: Add a successful example for str.index() method #144408
Closed
@adorilson
adorilson requested a review from vstinner February 3, 2026 10:08
vstinner
vstinner approved these changes Feb 3, 2026
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Feb 3, 2026
@vstinner

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
Merge branch 'main' into 106318.rindex
8fdfe10
@vstinner
vstinner enabled auto-merge (squash) February 3, 2026 13:23
@vstinner vstinner added needs backport to 3.13 only 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

Uh oh!

There was an error while loading. Please reload this page.

@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Feb 3, 2026
@miss-islington-app

miss-islington-app Bot commented 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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Feb 3, 2026
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 3, 2026
@adorilson @vstinner @miss-islington
pythongh-106318: Add examples for str.rindex() method (pythonGH-143887)
0da097e
(cherry picked from commit 45d00a0)

Co-authored-by: Adorilson Bezerra <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 3, 2026
@adorilson @vstinner @miss-islington
pythongh-106318: Add examples for str.rindex() method (pythonGH-143887)
e20739a
(cherry picked from commit 45d00a0)

Co-authored-by: Adorilson Bezerra <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
@bedevere-app

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app 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
@miss-islington @adorilson @vstinner
[3.14] gh-106318: Add examples for str.rindex() method (GH-143887) (#…
cc8fd6a
…144421)

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

Co-authored-by: Adorilson Bezerra <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this pull request Feb 3, 2026
@miss-islington @adorilson @vstinner
[3.13] gh-106318: Add examples for str.rindex() method (GH-143887) (#…
4482064
…144422)

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

Co-authored-by: Adorilson Bezerra <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
@vstinner

vstinner commented Feb 3, 2026

Copy link
Copy Markdown
Member

Merged, thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Aniketsy pushed a commit to Aniketsy/cpython that referenced this pull request Feb 3, 2026
@adorilson @vstinner @Aniketsy
pythongh-106318: Add examples for str.rindex() method (python#143887)
de7cedc
Co-authored-by: Victor Stinner <[email protected]>
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
@adorilson @vstinner @thunder-coding
pythongh-106318: Add examples for str.rindex() method (python#143887)
bafa22d
Co-authored-by: Victor Stinner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@adorilson @vstinner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.