Problem in help for str().rsplit()
Greetings to the list Not sure where this report should be sent, so I’m hoping the good people on this list can help to forward it on. The docs suggest I should distinguish a bug as being either of the docs, or of the implementation, but this one is in the docstring of the function, so which does that count as??? What I would call "the docs” (https://docs.python.org/3/library/stdtypes.html?highlight=rsplit#str.rsplit <https://docs.python.org/3/library/stdtypes.html?highlight=rsplit#str.rsplit>) explains the function differently, and is (AFAICT) correct Problem is in docstring for the str().rsplit() method:
help(str().rsplit) Help on built-in function rsplit:
rsplit(sep=None, maxsplit=-1) method of builtins.str instance Return a list of the substrings in the string, using sep as the separator string. sep 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 Maximum number of splits (starting from the left). -1 (the default value) means no limit. Splitting starts at the end of the string and works to the front. Problem is at the phrase "(starting from the left)” I think that should actually say “starting from the right”, because
s = "alan was here today" s.rsplit(" ", 1) ['alan was here', 'today']
-- Alan
Hello, Thank you for your report. It is now tracked at: https://github.com/python/cpython/issues/110383 On 06. 07. 23 19:56, Alan Brogan wrote:
Greetings to the list
Not sure where this report should be sent, so I’m hoping the good people on this list can help to forward it on. The docs suggest I should distinguish a bug as being either of the docs, or of the implementation, but this one is in the docstring of the function, so which does that count as???
What I would call "the docs” (https://docs.python.org/3/library/stdtypes.html?highlight=rsplit#str.rsplit <https://docs.python.org/3/library/stdtypes.html?highlight=rsplit#str.rsplit>) explains the function differently, and is (AFAICT) correct
Problem is in docstring for the str().rsplit() method:
>>> help(str().rsplit) Help on built-in function rsplit:
rsplit(sep=None, maxsplit=-1) method of builtins.str instance Return a list of the substrings in the string, using sep as the separator string.
sep 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 Maximum number of splits (starting from the left). -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
Problem is at the phrase "(starting from the left)” I think that should actually say “starting from the right”, because
>>> s = "alan was here today" >>> s.rsplit(" ", 1) ['alan was here', 'today']
-- Alan
_______________________________________________ docs mailing list -- docs@python.org To unsubscribe send an email to docs-leave@python.org https://mail.python.org/mailman3/lists/docs.python.org/ Member address: encukou@gmail.com
participants (2)
-
Alan Brogan
-
Petr Viktorin