Skip to content

The argument name sep of split() should be like del which means delimiter for consistency #136106

Closed as not planned
@hyperkai

Description

@hyperkai

The doc of split() is explained with the words, delimiter, delimiters and delimit a lot more than the words related to separator but the argument name is sep which means separator as shown below:

str.split(sep=None,` maxsplit=-1)
Return a list of the words in the string, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done (thus, the list will have at most maxsplit+1 elements). If maxsplit is not specified or -1, then there is no limit on the number of splits (all possible splits are made).

If sep is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, '1,,2'.split(',') returns ['1', '', '2']). The sep argument may consist of multiple characters as a single delimiter (to split with multiple delimiters, use re.split()). Splitting an empty string with a specified separator returns [''].

So, the argument name sep should be like del which means delimiter for consistency as shown below. *The argument name sep of [rsplit()]https://docs.python.org/3/library/stdtypes.html#bytes.rsplit) should also be like below:

str.split(del=None,` maxsplit=-1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions