From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 4 Jun 2026 13:23:07 +0000 (+0200) Subject: [3.13] gh-106318: Add doctest role and a 'See also' to the `str.split()` docs (GH... X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=d7beb9c06d1e0f36f2f0665c0cd89d0a351e04ec;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-106318: Add doctest role and a 'See also' to the `str.split()` docs (GH-144367) (cherry picked from commit a96cba5c4aa3cf859a9cacab590fc1a51d6efbbb) Co-authored-by: Adorilson Bezerra --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index d33fba51e5ad..3f59131e2600 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2461,7 +2461,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'] @@ -2479,7 +2481,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'] @@ -2491,7 +2495,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) [] @@ -2500,7 +2506,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::