Skip to content

Fix bad grammar and improve docstring for split/rsplit #32381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
bbd2da9
Merge pull request #1 from python/master
rhettinger Mar 16, 2021
74bdf1b
Merge branch 'master' of github.com:python/cpython
rhettinger Mar 22, 2021
6c53f1a
Merge branch 'master' of github.com:python/cpython
rhettinger Mar 22, 2021
a487c4f
.
rhettinger Mar 24, 2021
eb56423
.
rhettinger Mar 25, 2021
cc7ba06
.
rhettinger Mar 26, 2021
d024dd0
.
rhettinger Apr 22, 2021
b10f912
merge
rhettinger May 5, 2021
fb6744d
merge
rhettinger May 6, 2021
7f21a1c
Merge branch 'main' of github.com:python/cpython
rhettinger Aug 15, 2021
7da42d4
Merge branch 'main' of github.com:rhettinger/cpython
rhettinger Aug 25, 2021
e31757b
Merge branch 'main' of github.com:python/cpython
rhettinger Aug 31, 2021
f058a6f
Merge branch 'main' of github.com:python/cpython
rhettinger Aug 31, 2021
1fc29bd
Merge branch 'main' of github.com:python/cpython
rhettinger Sep 4, 2021
e5c0184
Merge branch 'main' of github.com:python/cpython
rhettinger Oct 30, 2021
3c86ec1
Merge branch 'main' of github.com:python/cpython
rhettinger Nov 9, 2021
96675e4
Merge branch 'main' of github.com:rhettinger/cpython
rhettinger Nov 9, 2021
de558c6
Merge branch 'main' of github.com:python/cpython
rhettinger Nov 9, 2021
418a07f
Merge branch 'main' of github.com:python/cpython
rhettinger Nov 14, 2021
ea23a8b
Merge branch 'main' of github.com:python/cpython
rhettinger Nov 21, 2021
ba248b7
Merge branch 'main' of github.com:python/cpython
rhettinger Nov 27, 2021
9bc1df1
Merge branch 'main' of github.com:python/cpython
rhettinger Dec 1, 2021
d4466ba
Merge branch 'main' of github.com:python/cpython
rhettinger Dec 1, 2021
a89f02e
Merge branch 'main' of github.com:python/cpython
rhettinger Dec 8, 2021
aae9a5f
Merge branch 'main' of github.com:python/cpython
rhettinger Dec 10, 2021
7ba634b
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 1, 2022
4910ba3
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 5, 2022
0e8d64a
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 9, 2022
7e49f3e
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 10, 2022
6257706
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 18, 2022
2fb7e2c
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 23, 2022
b345021
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 23, 2022
cbb9ace
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 23, 2022
7642c27
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 23, 2022
2320c28
Merge branch 'main' of github.com:python/cpython
rhettinger Jan 30, 2022
9dbc96c
Merge branch 'main' of github.com:python/cpython
rhettinger Feb 3, 2022
b69483b
Fix bad grammar and import docstring for split/rsplit
rhettinger Apr 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions Objects/clinic/unicodeobject.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 16 additions & 9 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -13220,19 +13220,26 @@ PyUnicode_Split(PyObject *s, PyObject *sep, Py_ssize_t maxsplit)
str.split as unicode_split

sep: object = None
The delimiter according which to split the string.
None (the default value) means split according to any whitespace,
and discard empty strings from the result.
The separator used to split the string.

When set to None (the default value), will split on any whitespace
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 to do.
Maximum number of splits (starting from the left).
-1 (the default value) means no limit.

Return a list of the words in the string, using sep as the delimiter string.
Return a list of the substrings in the string, using sep as the separator string.

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.

[clinic start generated code]*/

static PyObject *
unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
/*[clinic end generated code: output=3a65b1db356948dc input=606e750488a82359]*/
/*[clinic end generated code: output=3a65b1db356948dc input=906d953b44efc43b]*/
{
if (sep == Py_None)
return split(self, NULL, maxsplit);
Expand Down Expand Up @@ -13403,14 +13410,14 @@ PyUnicode_RSplit(PyObject *s, PyObject *sep, Py_ssize_t maxsplit)
/*[clinic input]
str.rsplit as unicode_rsplit = str.split

Return a list of the words in the string, using sep as the delimiter string.
Return a list of the substrings in the string, using sep as the separator string.

Splits are done starting at the end of the string and working to the front.
Splitting starts at the end of the string and works to the front.
[clinic start generated code]*/

static PyObject *
unicode_rsplit_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
/*[clinic end generated code: output=c2b815c63bcabffc input=12ad4bf57dd35f15]*/
/*[clinic end generated code: output=c2b815c63bcabffc input=ea78406060fce33c]*/
{
if (sep == Py_None)
return rsplit(self, NULL, maxsplit);
Expand Down