gh-106318: Add string method examples#119445
Draft
blaisep wants to merge 67 commits intopython:mainfrom
Draft
Conversation
hugovk
reviewed
May 28, 2024
hugovk
reviewed
May 28, 2024
encukou
reviewed
May 29, 2024
blaisep
commented
Jun 5, 2024
Fix indentation
accepted
accepted
hugovk
reviewed
Jun 6, 2024
| >>> 'Python'.rjust(10, '.') | ||
| '....Python' | ||
|
|
||
| The original string is returned if *width* is less than or equal to ``len(s)``. |
Member
There was a problem hiding this comment.
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.
Contributor
Author
|
I'll update this with the suggestions from https://www.youtube.com/live/-0SXSTkJsfg?si=yRQG9Pm0ochACy_x&t=3883 |
From office hours at https://www.youtube.com/live/-0SXSTkJsfg?si=QKhDzyWPVvWRLcDO&t=4267 Co-authored-by: Lisa Crispin <[email protected]>
adorilson
reviewed
Jun 11, 2024
adorilson
reviewed
Jun 11, 2024
adorilson
reviewed
Jun 11, 2024
Contributor
Author
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. |
Fix doctest formatting errors
adorilson
suggested changes
Jul 16, 2024
| ... | ||
| >>> '{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' |
Contributor
There was a problem hiding this comment.
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.
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
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.
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.rstto include various suggestions and to have me update the related PRSo I pulled the branch, resolved merge conflicts, edited the file and created this PR.
Mentioning others who might be interested:
@hauntsaninja , @CAM-Gerlach , @encukou
📚 Documentation preview 📚: https://cpython-previews--119445.org.readthedocs.build/en/119445/library/stdtypes.html