Guido van Rossum added the comment:
I like the proposal. I agree that filter(None, ...) is not discoverable (and
has its own magic).
So the proposal would be: prune=False -> empty strings stay, prune=True, empty
strings are dropped, prune=None (default) use True if sep is None, False
otherwise. Right?
Some end cases:
- ''.split(None, prune=True) -> ['']
- 'x x'.split(None, prune=True) -> ['x', '', 'x']
Right?
While we're here I wish there was a specific argument we could translate
.split(None) into, e.g. x.split() == x.split((' ', '\t', '\n', '\r', '\f')) #
or whatever set of strings
----------
_______________________________________
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