https://github.com/python/cpython/commit/bd3add06f6685502da78c52d0bee5b04ca708425
commit: bd3add06f6685502da78c52d0bee5b04ca708425
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: terryjreedy <[email protected]>
date: 2025-05-14T21:33:38-04:00
summary:

[3.13] gh-133986: Document string split algorithm when sep is None and 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 commit 3e23047363f384b7254b7af51afe4e353be94167)

Co-authored-by: Joey Smith <[email protected]>
Co-authored-by: Ned Batchelder <[email protected]>
Co-authored-by: Semyon Moroz <[email protected]>

files:
M Doc/library/stdtypes.rst

diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 0936be0caaf903..ccaa0efaada7c7 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -2133,6 +2133,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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to