Message283021
On Dec 12, 2016, at 04:16 PM, Guido van Rossum wrote:
>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?
Yep!
>Some end cases:
>
>- ''.split(None, prune=True) -> ['']
>- 'x x'.split(None, prune=True) -> ['x', '', 'x']
>
>Right?
Isn't that what you'd expect if prune=False instead? (i.e. prune=True always
drops empty strings from the results)
>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
Is that the sep=<some tuple> idea that @syeberman suggested earlier? If so,
then you could do:
>>> x.split(tuple(string.whitespace))
Would that suffice? |
|
Date |
User |
Action |
Args |
2016-12-12 16:26:08 | barry | set | recipients:
+ barry, gvanrossum, rhettinger, syeberman, mrabarnett, serhiy.storchaka, veky, abarry |
2016-12-12 16:26:08 | barry | link | issue28937 messages |
2016-12-12 16:26:07 | barry | create | |
|