Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-133986: Document string split algorithm when sep is None and maxsplit is 0#133987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nedbat merged 2 commits intopython:mainfromtml:main
May 14, 2025

Conversation

tml
Copy link
Contributor

@tmltml commentedMay 14, 2025
edited by github-actionsbot
Loading

If sep is not specified or is None and maxsplit is 0, only leading runs of consecutive whitespace are considered. This is contrary to (or, at least, underspecified in) the current documentation.

I have documented the observed behaviour, and added some example code.


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

@python-cla-bot
Copy link

python-cla-botbot commentedMay 14, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

Co-authored-by: Semyon Moroz <donbarbos@proton.me>
@nedbatnedbat merged commit3e23047 intopython:mainMay 14, 2025
24 checks passed
@github-project-automationgithub-project-automationbot moved this fromTodo toDone inDocs PRsMay 14, 2025
@nedbatnedbat added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsMay 14, 2025
@miss-islington-app
Copy link

Thanks@tml for the PR, and@nedbat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks@tml for the PR, and@nedbat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 14, 2025
… maxsplit is 0 (pythonGH-133987)* Document string split algorithm when sep is None and maxsplit is 0* Update Doc/library/stdtypes.rstCo-authored-by: Semyon Moroz <donbarbos@proton.me>---------(cherry picked from commit3e23047)Co-authored-by: Joey Smith <joeysmith@gmail.com>Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>Co-authored-by: Semyon Moroz <donbarbos@proton.me>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 14, 2025
… maxsplit is 0 (pythonGH-133987)* Document string split algorithm when sep is None and maxsplit is 0* Update Doc/library/stdtypes.rstCo-authored-by: Semyon Moroz <donbarbos@proton.me>---------(cherry picked from commit3e23047)Co-authored-by: Joey Smith <joeysmith@gmail.com>Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>Co-authored-by: Semyon Moroz <donbarbos@proton.me>
@bedevere-app
Copy link

GH-133992 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelMay 14, 2025
@bedevere-app
Copy link

GH-133993 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMay 14, 2025
@The-Compiler
Copy link
Contributor

The-Compiler commentedMay 14, 2025
edited
Loading

I'm a bit late I suppose, but I don't think this is specific tomaxsplit=0?

>>>"   foo   bar   ".split(maxsplit=1)['foo','bar   ']

terryjreedy pushed a commit that referenced this pull requestMay 15, 2025
…d maxsplit is 0 (GH-133987) (#133993)---------(cherry picked from commit3e23047)Co-authored-by: Joey Smith <joeysmith@gmail.com>Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>Co-authored-by: Semyon Moroz <donbarbos@proton.me>
terryjreedy pushed a commit that referenced this pull requestMay 15, 2025
…d maxsplit is 0 (GH-133987) (#133992)gh-133986: Document string split algorithm when sep is None and maxsplit is 0 (GH-133987)---------(cherry picked from commit3e23047)Co-authored-by: Joey Smith <joeysmith@gmail.com>Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>Co-authored-by: Semyon Moroz <donbarbos@proton.me>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@donBarbosdonBarbosdonBarbos left review comments

Assignees
No one assigned
Labels
docsDocumentation in the Doc dirskip news
Projects
Status: Done
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@tml@The-Compiler@donBarbos@nedbat

[8]ページ先頭

©2009-2025 Movatter.jp