]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-106318: Add doctest role and a 'See also' to the `str.split()` docs (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 4 Jun 2026 13:23:15 +0000 (15:23 +0200)
committerGitHub <noreply@github.com>
Thu, 4 Jun 2026 13:23:15 +0000 (14:23 +0100)
(cherry picked from commit a96cba5c4aa3cf859a9cacab590fc1a51d6efbbb)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Doc/library/stdtypes.rst

index ec8be5f6dddea95d14dd3c4210873d617af7dfcd..0b4ca3354931c81da7be59ed838cc391e67d986c 100644 (file)
@@ -2612,7 +2612,9 @@ expression support in the :mod:`re` module).
    :func:`re.split`). Splitting an empty string with a specified separator
    returns ``['']``.
 
-   For example::
+   For example:
+
+   .. doctest::
 
       >>> '1,2,3'.split(',')
       ['1', '2', '3']
@@ -2630,7 +2632,9 @@ expression support in the :mod:`re` module).
    string or a string consisting of just whitespace with a ``None`` separator
    returns ``[]``.
 
-   For example::
+   For example:
+
+   .. doctest::
 
       >>> '1 2 3'.split()
       ['1', '2', '3']
@@ -2642,7 +2646,9 @@ expression support in the :mod:`re` module).
    If *sep* is not specified or is ``None`` and  *maxsplit* is ``0``, only
    leading runs of consecutive whitespace are considered.
 
-   For example::
+   For example:
+
+   .. doctest::
 
       >>> "".split(None, 0)
       []
@@ -2651,7 +2657,7 @@ expression support in the :mod:`re` module).
       >>> "   foo   ".split(maxsplit=0)
       ['foo   ']
 
-   See also :meth:`join`.
+   See also :meth:`join` and :meth:`rsplit`.
 
 
 .. index::