Skip to content

Commit c713252

Browse files
erlend-aaslandGlyphack
authored andcommitted
pythongh-110383: Improve accuracy of str.split() and str.rsplit() docstrings (python#113355)
Clarify split direction in the docstring body, instead of in the 'maxsplit' param docstring.
1 parent f3daef8 commit c713252

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Objects/clinic/unicodeobject.c.h

+5-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/unicodeobject.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -12504,11 +12504,13 @@ str.split as unicode_split
1250412504
character (including \n \r \t \f and spaces) and will discard
1250512505
empty strings from the result.
1250612506
maxsplit: Py_ssize_t = -1
12507-
Maximum number of splits (starting from the left).
12507+
Maximum number of splits.
1250812508
-1 (the default value) means no limit.
1250912509
1251012510
Return a list of the substrings in the string, using sep as the separator string.
1251112511
12512+
Splitting starts at the front of the string and works to the end.
12513+
1251212514
Note, str.split() is mainly useful for data that has been intentionally
1251312515
delimited. With natural text that includes punctuation, consider using
1251412516
the regular expression module.
@@ -12517,7 +12519,7 @@ the regular expression module.
1251712519

1251812520
static PyObject *
1251912521
unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
12520-
/*[clinic end generated code: output=3a65b1db356948dc input=07b9040d98c5fe8d]*/
12522+
/*[clinic end generated code: output=3a65b1db356948dc input=a29bcc0c7a5af0eb]*/
1252112523
{
1252212524
if (sep == Py_None)
1252312525
return split(self, NULL, maxsplit);

0 commit comments

Comments
 (0)