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 string method examples by blaisep · Pull Request #119445 · python/cpython

Conversation

@blaisep

@blaisep blaisep commented May 22, 2024 •
edited by hugovk
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

This PR reformats the examples created by @adorilson in #105670
I followed the discussion in a related PR #111743 , and then discussed it with @encukou and @CAM-Gerlach .
We decided that the fastest way to get the content into the docs was to edit the stdtypes.rst to include various suggestions and to have me update the related PR
So I pulled the branch, resolved merge conflicts, edited the file and created this PR.

Mentioning others who might be interested:
@hauntsaninja , @CAM-Gerlach , @encukou

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

📚 Documentation preview 📚: https://cpython-previews--119445.org.readthedocs.build/en/119445/library/stdtypes.html

Sorry, something went wrong.

Uh oh!

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

All reactions
adorilson added 30 commits June 11, 2023 19:43
@adorilson
[Doc] Added snippet code to str.join method
5508700
@adorilson
[Doc] Added snippet code to str.ljust method
e388d45
@adorilson
[Doc] Added snippet code to str.rjust method
d8407ba
@adorilson
[Doc] Added 'See also' in str.lstrip and str.rstrip methods from one …
08b88ef
…to the another
@adorilson
[Doc] Added snippet code to str.maketrans method
52e3a6b
@adorilson
[Doc] Added snippet code to str.translate method
dee059c
@adorilson
[Doc] Added snippet code to str.partition method
1671497
@adorilson
[Doc] Added snippet code to str.replace method
c832623
@adorilson
[Doc] Added snippet code to str.rfind method
0be8170
@adorilson
[Doc] Added snippet code to str.rindex method
ff65bd2
@adorilson
[Doc] Added snippet code to str.rpartition method
322c88c
@adorilson
[DOC] minor change
3a473df
@adorilson
[Doc] Added snippet code to str.rsplit method
b653693
@adorilson
[Doc] Added snippet code to str.startswith method
1b412cb
@adorilson
[Doc] Added snippet code to str.swapcase method
fb56441
@adorilson
[Doc] Added snippet code to str.upper method
04a5212
@adorilson
[DOC] Added snipped code in str.capitalize
8771775
@adorilson
[DOC] Add snippet code in str.casefold and str.lower methods
f2e224c
@adorilson
[DOC] Added snippet code in str.center method
1d39f92
@adorilson
[DOC] Added snippet code in str.count method
b3a70b6
@adorilson
[DOC] fix typo
37477f8
@adorilson
[DOC] Added snippet code in str.encode method
f9a7293
@adorilson
[DOC] Added snippet code to str.endswith method
2e54cb0
@adorilson
[DOC] Added snippet code with \n to str.expandtabs method
96d9bf6
@adorilson
[DOC] Added snippet code to str.index method
d1dc7e0
@adorilson
[DOC] Added snippet code to str.isalnum method
8661d8e
@adorilson
[DOC] Added snippet code in str.isalpha method
9e1f289
@adorilson
[DOC] Added snippet code in str.isascii method
9e361d8
@adorilson
[DOC] Added snippet code to str.isdecimal method
09a463a
@adorilson
[Doc] Added snippet code to str.isdigit method
641de5c
@blaisep
blaisep marked this pull request as ready for review May 28, 2024 07:05
@bedevere-app bedevere-app Bot added the awaiting review label May 28, 2024
hugovk
hugovk reviewed May 28, 2024
View reviewed changes
Comment thread Modules/_xxtestfuzz/fuzz_elementtree_parsewhole_corpus/expat224_utf8_bug.xml

@hugovk hugovk May 28, 2024

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.

This change needs reverting.

Sorry, something went wrong.

Uh oh!

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

All reactions
hugovk
hugovk reviewed May 28, 2024
View reviewed changes
Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

encukou
encukou reviewed May 29, 2024
View reviewed changes
Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

blaisep
blaisep commented Jun 5, 2024
View reviewed changes
Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

blaisep added 3 commits June 5, 2024 13:21
@blaisep
Update Doc/library/stdtypes.rst
48bed4c
Fix indentation
@blaisep
Update Doc/library/stdtypes.rst
dce8f2b
accepted
@blaisep
Update Doc/library/stdtypes.rst
24c1f6a
accepted
hugovk
hugovk reviewed Jun 6, 2024
View reviewed changes
Comment thread Doc/library/stdtypes.rst
>>> 'Python'.rjust(10, '.')
'....Python'

The original string is returned if *width* is less than or equal to ``len(s)``.

@hugovk hugovk Jun 6, 2024

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.

I think this might fix the Sphinx error:

Suggested change
The original string is returned if *width* is less than or equal to ``len(s)``.
The original string is returned if *width* is less than or equal to ``len(s)``.

For some reason, reST is usually indented in multiples of 3 spaces.

Sorry, something went wrong.

Uh oh!

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

blaisep reacted with eyes emoji
All reactions
  • 👀 1 reaction
@blaisep
blaisep marked this pull request as draft June 6, 2024 23:44
@bedevere-app bedevere-app Bot removed the awaiting review label Jun 6, 2024
@blaisep

blaisep commented Jun 7, 2024

Copy link
Copy Markdown
Contributor Author

I'll update this with the suggestions from https://www.youtube.com/live/-0SXSTkJsfg?si=yRQG9Pm0ochACy_x&t=3883

adorilson reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

blaisep and others added 3 commits June 10, 2024 12:30
@blaisep
WIP update some examples
fb2fe01
@blaisep
Merge branch 'pr-105670' of github.com:blaisep/cpython into pr-105670
0beabee
@blaisep @lisacrispin
WIP Edit and change some examples
02b2cd8
From office hours at https://www.youtube.com/live/-0SXSTkJsfg?si=QKhDzyWPVvWRLcDO&t=4267

Co-authored-by: Lisa Crispin <[email protected]>
adorilson
adorilson reviewed Jun 11, 2024
View reviewed changes
Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

adorilson
adorilson reviewed Jun 11, 2024
View reviewed changes
Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

adorilson
adorilson reviewed Jun 11, 2024
View reviewed changes
Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

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

adorilson
adorilson suggested changes Jun 11, 2024
View reviewed changes

@adorilson adorilson left a comment

Copy link
Copy Markdown
Contributor

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.

I notice some possible errors, @blaisep

Sorry, something went wrong.

Uh oh!

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

blaisep reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-app bedevere-app Bot added the awaiting core review label Jun 11, 2024
@blaisep

blaisep commented Jun 13, 2024

Copy link
Copy Markdown
Contributor Author

I notice some possible errors, @blaisep

Yes, I am marking this draft and going over it much more carefully. BTW, @adorilson , I will be in UTC-4 for the rest of the week and happy to pair up on this if you like. I'll add you to my fork.

adorilson reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@blaisep
Extend the example for str.format_map
0dd8138
Fix doctest formatting errors
adorilson
adorilson suggested changes Jul 16, 2024
View reviewed changes
Comment thread Doc/library/stdtypes.rst
...
>>> '{name} was born in {country}'.format_map(Default(name='Guido'))
>>> '{name} was born in {country}'.format_map(Default(name='Guido', country='Netherlands'))
'Guido was born in country'

@adorilson adorilson Jul 16, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

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.

This is supposed to be:

'Guido was born in Netherlands'

However, I think the previous example is more valuable. It shows the two Default class behaviour.

Sorry, something went wrong.

Uh oh!

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

encukou and blaisep reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@adorilson adorilson mentioned this pull request Sep 26, 2024
Improvements in regular expression doc #114357
Open
@willingc willingc removed the awaiting core review label Oct 30, 2024
@hugovk hugovk mentioned this pull request Dec 1, 2024
Add examples for all Python features in doc #127489
Closed
@blaisep blaisep mentioned this pull request May 19, 2025
gh-106318: Add an example for str.capitalize() #134272
Merged
@adorilson

adorilson commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

It could be closed in favor of all other PR linked to #106318

hugovk reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@hugovk hugovk closed this Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@encukou encukou encukou left review comments
@hugovk hugovk hugovk left review comments
+1 more reviewer
@adorilson adorilson adorilson requested changes
Reviewers whose approvals may not affect merge requirements

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

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.

6 participants

@blaisep @adorilson @encukou @hugovk @willingc @hauntsaninja
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.