Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
python-cla-botbot commentedMay 14, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
3e23047
intopython:mainUh oh!
There was an error while loading.Please reload this page.
… 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>
… 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>
GH-133992 is a backport of this pull request to the3.13 branch. |
GH-133993 is a backport of this pull request to the3.14 branch. |
The-Compiler commentedMay 14, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm a bit late I suppose, but I don't think this is specific to >>>" foo bar ".split(maxsplit=1)['foo','bar '] |
…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>
Uh oh!
There was an error while loading.Please reload this page.
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/