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

Raymond Hettinger report at bugs.python.org
Mon Dec 12 01:18:21 EST 2016


Raymond Hettinger added the comment:

Guido, do you have an option on this?  IIRC, this was an API you created.

Nick's thought (posted on twitter) is that 'filter(None, sep.split(input)' already covers the "drop the empty values" case. 

My feelings are mixed.  Though I've never needed in practice, it would be nice if the whitespace removal algorithm could be customized to just a space or just a tab.   On the other hand, I think the new parameter would make the API more confusing and harder to learn.  It might be better to just document either the filter(None) approach or a simple regex for the less common cases.

----------
nosy: +gvanrossum

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


More information about the Python-bugs-list mailing list