Emanuel Barry added the comment:
I understand the feeling. However, in a project I maintain, we want the other
way around - to be able to never have an empty list, even if the string is
empty (we resorted to using re.split in the end, which has this behaviour).
Consider:
rest = re.split(" +", rest)[0].strip()
This gives us None-like behaviour in splitting, at the cost of not actually
using str.split.
I'm +1 on the idea, but I'd like some way to better generalize str.split use
(not everyone knows you can pass None and/or an integer).
(At the same time, the counter arguments where str has too many methods, or
that methods shouldn't do too much, also apply here.)
But I don't like bikeshedding too much, so let's just count me as +1 for your
way, if there's no strong momentum for mine :)
----------
nosy: +ebarry
type: -> enhancement
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28937>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com