Mark Bell <mark00b...@googlemail.com> added the comment:

> Instead, the discussion was focused on removing *all* empty strings from the 
> result.

I imagine that the discussion focussed on this since this is precisely what 
happens when sep=None. For example, 'a     b   c     ​'.split() == ['a', 'b', 
'c']. I guess that the point was to provide users with explicit, manual control 
over whether the behaviour of split should drop all empty strings or retain all 
empty strings instead of this decision just being made on whether sep is None 
or not.

So I wonder whether the "expected" solution for parsing CSV like strings is for 
you to actually filter out the empty strings yourself and never pass them to 
split at all. For example by doing something like:

[line.split(sep=',') for line in content.splitlines() if line]

but if this is the case then this is the kind of thing that would require 
careful thought about what is the right name for this parameter / right way to 
express this in the documentation to make sure that users don't fall into the 
trap that you mentioned.

> Sorry that I bring this up only now when the discussion was finished and the 
> work on PR completed; I wish I had seen the issue sooner.

Of course, but the main thing is that you spotted this before the PR was merged 
:)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue28937>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to