]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-110383: Improve accuracy of str.split() and str.rsplit() docstrings (GH...
authorHugo van Kemenade <hugovk@users.noreply.github.com>
Fri, 22 Dec 2023 07:43:38 +0000 (09:43 +0200)
committerGitHub <noreply@github.com>
Fri, 22 Dec 2023 07:43:38 +0000 (00:43 -0700)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Objects/clinic/unicodeobject.c.h
Objects/unicodeobject.c

index 7a42cd8ffc939ac5c5faf0d6353e6f2de543d79c..0f1dd7c2b92142cb57546dcba0f65c5d8bfdbeb9 100644 (file)
@@ -885,9 +885,11 @@ PyDoc_STRVAR(unicode_split__doc__,
 "    character (including \\n \\r \\t \\f and spaces) and will discard\n"
 "    empty strings from the result.\n"
 "  maxsplit\n"
-"    Maximum number of splits (starting from the left).\n"
+"    Maximum number of splits.\n"
 "    -1 (the default value) means no limit.\n"
 "\n"
+"Splitting starts at the front of the string and works to the end.\n"
+"\n"
 "Note, str.split() is mainly useful for data that has been intentionally\n"
 "delimited.  With natural text that includes punctuation, consider using\n"
 "the regular expression module.");
@@ -986,7 +988,7 @@ PyDoc_STRVAR(unicode_rsplit__doc__,
 "    character (including \\n \\r \\t \\f and spaces) and will discard\n"
 "    empty strings from the result.\n"
 "  maxsplit\n"
-"    Maximum number of splits (starting from the left).\n"
+"    Maximum number of splits.\n"
 "    -1 (the default value) means no limit.\n"
 "\n"
 "Splitting starts at the end of the string and works to the front.");
@@ -1353,4 +1355,4 @@ skip_optional_pos:
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=11519887c1619a4e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c25ec2c388409c94 input=a9049054013a1b77]*/
index c27fc009c5664e7dab619e394c96502aaa7a3316..47c4e2a103a4a8ea7368a6e575995ebefc220889 100644 (file)
@@ -13170,11 +13170,13 @@ str.split as unicode_split
         character (including \n \r \t \f and spaces) and will discard
         empty strings from the result.
     maxsplit: Py_ssize_t = -1
-        Maximum number of splits (starting from the left).
+        Maximum number of splits.
         -1 (the default value) means no limit.
 
 Return a list of the substrings in the string, using sep as the separator string.
 
+Splitting starts at the front of the string and works to the end.
+
 Note, str.split() is mainly useful for data that has been intentionally
 delimited.  With natural text that includes punctuation, consider using
 the regular expression module.
@@ -13183,7 +13185,7 @@ the regular expression module.
 
 static PyObject *
 unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
-/*[clinic end generated code: output=3a65b1db356948dc input=07b9040d98c5fe8d]*/
+/*[clinic end generated code: output=3a65b1db356948dc input=a29bcc0c7a5af0eb]*/
 {
     if (sep == Py_None)
         return split(self, NULL, maxsplit);