Andrei Kulakov <andrei....@gmail.com> added the comment:

Mark:

With sep=None, I don't think there is an issue. My only concern is when sep is 
set to some other value.

The original issue was that the single empty str result is removed when using 
sep=None and that it's kept when sep is some other value. So the most direct 
solution would seem to be to have a flag that controls the removal/retention of 
a single empty str in results.

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

My concern is that this doesn't solve the original issue in some cases, i.e. if 
I want to use a sep other than None, and I want an empty line to mean there are 
no values (result=[]), but I do want to keep empty values (a,, => [a,'','']) -- 
all of these seem like fairly normal, not unusual requirements.

The second concern, as I noted in previous message, is a potential for bugs if 
this flag being interpreted narrowly as a solution for the original issue only.

[Note I don't think it would be a very widespread bug but I can see it 
happening occasionally.]

I think to avoid both of these issues we could change the flag to narrowly 
target the original issue, i.e. one empty str only. The name of the flag can 
remain the same or possibly something like `keep_single_empty` would be more 
explicit (though a bit awkward).

The downside is that we'd lose the convenience of splitting and filtering out 
all empties in one operation.

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.

----------

_______________________________________
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