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

Matthew Barnett report at bugs.python.org
Fri May 21 13:13:13 EDT 2021


Matthew Barnett <python at mrabarnett.plus.com> added the comment:

I've only just realised that the test cases don't cover all eventualities: none of them test what happens with multiple spaces _between_ the letters, such as:

    '  a  b c '.split(maxsplit=1) == ['a', 'b c ']

Comparing that with:

    '  a  b c '.split(' ', maxsplit=1)

you see that passing None as the split character does not mean "any whitespace character". There's clearly a little more to it than that.

----------

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


More information about the Python-bugs-list mailing list