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
Allow "maxsplit" argument to str.split() to be passed as a keyword argument #58289
Comments
Currently, setting maxsplit for the default "any whitespace" behaviour requires the following cryptic incantation:
That would be significantly more comprehensible as:
(I noticed this when trying to figure out why http://hyperpolyglot.org/scripting#split-notes resorted to using the re module to achieve this) |
+1 |
New patch that changes .rsplit() too and updates docs and docstrings. |
LGTM. (Nick: I think the author directly translated the regex function calls from other languages to using re in Python.) |
Ezio: I spotted an extraneous '[' hanging around in the updated doc signature for split, but otherwise looked fine. Éric: you're probably right, but I was sending them a note to suggest a simpler alternative, only to discover that the obvious approach of "maxsplit=1" didn't actually work. |
New changeset db968ac2b82c by Ezio Melotti in branch 'default': |
Fixed! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: