Message283019
| Author |
gvanrossum |
| Recipients |
abarry, barry, gvanrossum, mrabarnett, rhettinger, serhiy.storchaka, syeberman, veky |
| Date |
2016年12月12日.16:16:06 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1481559366.77.0.00847882011175.issue28937@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|