Skip to content

gh-106318: Add examples for str.casefold() and str.lower() methods - #142154

Merged
vstinner merged 6 commits into
python:mainfrom
adorilson:106318.casefold_and_lower
Jan 7, 2026
Merged

gh-106318: Add examples for str.casefold() and str.lower() methods#142154
vstinner merged 6 commits into
python:mainfrom
adorilson:106318.casefold_and_lower

Conversation

@adorilson

@adorilsonadorilson commented Dec 1, 2025

Copy link
Copy Markdown
Contributor

WIP to #106318

gh-106318: Add examples for str.casefold() and str.lower() methods


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

Comment threadDoc/library/stdtypes.rst Outdated
lowercase letter ``'ß'`` is equivalent to ``"ss"``. Since it is already
lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:`casefold`
converts it to ``"ss"``.
converts it to ``"ss"``, as follows:

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.

I find this is a little repetitive, if one reads the sentence the example just repeats the exact same thing.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

What if we remove the sentence and put comments?

>>>'ß'.casefold() # the German lowercase letter ``'ß'``'ss'>>>'ß'.lower() # since it is already lowercase, lower does nothing'ß'

Comment threadDoc/library/stdtypes.rst Outdated
Co-authored-by: Victor Stinner <vstinner@python.org>
Comment threadDoc/library/stdtypes.rst Outdated
Co-authored-by: Victor Stinner <vstinner@python.org>

@vstinnervstinner 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.

LGTM

@StanFromIrelandStanFromIreland 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.

LGTM

Comment threadDoc/library/stdtypes.rst
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@vstinnervstinner added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jan 7, 2026
@vstinner
vstinner enabled auto-merge (squash) January 7, 2026 16:12
@vstinner
vstinner merged commit 51a56a3 into python:mainJan 7, 2026
32 checks passed
@github-project-automationgithub-project-automationBot moved this from Todo to Done in Docs PRsJan 7, 2026
@miss-islington-app

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 Jan 7, 2026
…ods (pythonGH-142154)
(cherry picked from commit 51a56a3)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 7, 2026
…ods (pythonGH-142154)
(cherry picked from commit 51a56a3)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@bedevere-app

Copy link
Copy Markdown

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

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label Jan 7, 2026
@bedevere-app

Copy link
Copy Markdown

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

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Jan 7, 2026
vstinner added a commit that referenced this pull request Jan 7, 2026
…hods (GH-142154) (#143524)
gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154)
(cherry picked from commit 51a56a3)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
vstinner added a commit that referenced this pull request Jan 7, 2026
…hods (GH-142154) (#143525)
gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154)
(cherry picked from commit 51a56a3)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@vstinner

Copy link
Copy Markdown
Member

Merged, thanks!

thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
…ods (python#142154)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docsDocumentation in the Doc dirskip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants

@adorilson@vstinner@StanFromIreland