[issue28937] str.split(): remove empty strings when sep is not None

Barry A. Warsaw report at bugs.python.org
Tue Mar 19 19:41:08 EDT 2019


Barry A. Warsaw <barry at python.org> added the comment:

@veky - Thank you for pointing out splitlines(keepends=True).  If we wanted consistency, then we'd change the sense and use something like .split(keepempty=True), however:

* I don't like run-on names, so I would suggest keep_empty
* Maybe just `keep` is enough
* Either way, this should be a keyword only argument
* The default would still be None (i.e. current behavior), but keep_empty=True would be equivalent to prune=False and keep_empty=False would be equivalent to prune=True in the previous discussion.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue28937>
_______________________________________


More information about the Python-bugs-list mailing list