Skip to content

Commit e79e03d

Browse files
erlend-aaslandhugovk
authored andcommitted
[3.12] pythongh-110383: Improve accuracy of str.split() and str.rsplit() docstrings (pythonGH-113355)
Clarify split direction in the docstring body, instead of in the 'maxsplit' param docstring. (cherry picked from commit 526d0a9) Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent c38ebb4 commit e79e03d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Objects/clinic/unicodeobject.c.h

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/unicodeobject.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12410,11 +12410,13 @@ str.split as unicode_split
1241012410
character (including \n \r \t \f and spaces) and will discard
1241112411
empty strings from the result.
1241212412
maxsplit: Py_ssize_t = -1
12413-
Maximum number of splits (starting from the left).
12413+
Maximum number of splits.
1241412414
-1 (the default value) means no limit.
1241512415
1241612416
Return a list of the substrings in the string, using sep as the separator string.
1241712417
12418+
Splitting starts at the front of the string and works to the end.
12419+
1241812420
Note, str.split() is mainly useful for data that has been intentionally
1241912421
delimited. With natural text that includes punctuation, consider using
1242012422
the regular expression module.
@@ -12423,7 +12425,7 @@ the regular expression module.
1242312425

1242412426
static PyObject *
1242512427
unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
12426-
/*[clinic end generated code: output=3a65b1db356948dc input=07b9040d98c5fe8d]*/
12428+
/*[clinic end generated code: output=3a65b1db356948dc input=a29bcc0c7a5af0eb]*/
1242712429
{
1242812430
if (sep == Py_None)
1242912431
return split(self, NULL, maxsplit);

0 commit comments

Comments
 (0)