https://github.com/python/cpython/commit/b6299e8f16c1e6ab1d3dab42f9803e00fb0bdddb
commit: b6299e8f16c1e6ab1d3dab42f9803e00fb0bdddb
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: terryjreedy <tjre...@udel.edu>
date: 2025-05-14T21:32:45-04:00
summary:

[3.14] gh-133986: Document string split algorithm when sep is None and maxsplit 
is 0 (GH-133987) (#133993)

---------
(cherry picked from commit 3e23047363f384b7254b7af51afe4e353be94167)

Co-authored-by: Joey Smith <joeysm...@gmail.com>
Co-authored-by: Ned Batchelder <n...@nedbatchelder.com>
Co-authored-by: Semyon Moroz <donbar...@proton.me>

files:
M Doc/library/stdtypes.rst

diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 1d9a655c7664ea..3486a18b5cb1f0 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -2269,6 +2269,18 @@ expression support in the :mod:`re` module).
       >>> '   1   2   3   '.split()
       ['1', '2', '3']
 
+   If *sep* is not specified or is ``None`` and  *maxsplit* is ``0``, only
+   leading runs of consecutive whitespace are considered.
+
+   For example::
+
+      >>> "".split(None, 0)
+      []
+      >>> "   ".split(None, 0)
+      []
+      >>> "   foo   ".split(maxsplit=0)
+      ['foo   ']
+
 
 .. index::
    single: universal newlines; str.splitlines method

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to