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

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

Co-authored-by: Joey Smith <joeysmith@gmail.com>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
This commit is contained in:
Miss Islington (bot) 2025-05-15 03:32:45 +02:00 committed by GitHub
parent 4adb1ddac8
commit b6299e8f16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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