This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author barry
Recipients abarry, barry, gvanrossum, mrabarnett, rhettinger, serhiy.storchaka, syeberman, veky
Date 2016-12-12.16:26:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20161212112604.36731825@subdivisions.wooz.org>
In-reply-to <1481559366.77.0.00847882011175.issue28937@psf.upfronthosting.co.za>
Content
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?
History
Date User Action Args
2016-12-12 16:26:08barrysetrecipients: + barry, gvanrossum, rhettinger, syeberman, mrabarnett, serhiy.storchaka, veky, abarry
2016-12-12 16:26:08barrylinkissue28937 messages
2016-12-12 16:26:07barrycreate