]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106318: Add doctest role and a 'See also' to the `str.split()` docs (#144367)
authorAdorilson Bezerra <adorilson@gmail.com>
Thu, 4 Jun 2026 11:39:14 +0000 (12:39 +0100)
committerGitHub <noreply@github.com>
Thu, 4 Jun 2026 11:39:14 +0000 (12:39 +0100)
Doc/library/stdtypes.rst

index ba896212925d89b712d4b4901e3ef5f703ddc0bc..f770809dfb4006c235ebfcc2240122657413adaf 100644 (file)
@@ -2616,7 +2616,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']
@@ -2634,7 +2636,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']
@@ -2646,7 +2650,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)
       []
@@ -2655,7 +2661,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::