[docs] [issue37620] str.split(sep=None, maxsplit=-1,any=False)

Raymond Hettinger report at bugs.python.org
Fri Jul 19 19:40:54 EDT 2019

Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Harry, thanks for the suggestion but we're going to pass for now.

For the most part, str.split() has stood the test of time and we use regexes for more customized or complicated variants.  In general, adding API options increases complexity for users, making the basic methods harder to learn and remember.  Fewer choices tends to make for easier programming. Guido has repeatedly given guidance to prefer separate functions and methods over putting multiple algorithmic flags in a single function or method.

If you want to pursue this further, consider posting to the python-ideas list.  You'll find more traction if you're able to find real-world code that would benefit from the new API.

One other thought: the API for the strip/lstrip/rstrip methods has the equivalent of the *any* option when *chars* are specified.  That has not worked out well -- people get surprised when the methods strip more than the exact string specified: 'there'.rstrip('re') --> 'th'.

resolution:  -> rejected
stage:  -> resolved
status: open -> closed

Python tracker <report at bugs.python.org>

More information about the docs mailing list