Skip to content

Commit 325b641

Browse files
erlend-aaslandhugovk
authored andcommitted
[3.11] 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 4baa4b5 commit 325b641

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
@@ -13170,11 +13170,13 @@ str.split as unicode_split
1317013170
character (including \n \r \t \f and spaces) and will discard
1317113171
empty strings from the result.
1317213172
maxsplit: Py_ssize_t = -1
13173-
Maximum number of splits (starting from the left).
13173+
Maximum number of splits.
1317413174
-1 (the default value) means no limit.
1317513175
1317613176
Return a list of the substrings in the string, using sep as the separator string.
1317713177
13178+
Splitting starts at the front of the string and works to the end.
13179+
1317813180
Note, str.split() is mainly useful for data that has been intentionally
1317913181
delimited. With natural text that includes punctuation, consider using
1318013182
the regular expression module.
@@ -13183,7 +13185,7 @@ the regular expression module.
1318313185

1318413186
static PyObject *
1318513187
unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
13186-
/*[clinic end generated code: output=3a65b1db356948dc input=07b9040d98c5fe8d]*/
13188+
/*[clinic end generated code: output=3a65b1db356948dc input=a29bcc0c7a5af0eb]*/
1318713189
{
1318813190
if (sep == Py_None)
1318913191
return split(self, NULL, maxsplit);

0 commit comments

Comments
 (0)