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 acg
Recipients acg
Date 2011-11-05.02:46:34
SpamBayes Score 1.238102e-09
Marked as misclassified No
Message-id <1320461196.01.0.560612390683.issue13346@psf.upfronthosting.co.za>
In-reply-to
Content
If you split a string in a maximum of zero places, you should get the original string back. "".split(s,0) behaves this way. But re.split(r,s,0) performs an unlimited number of splits in this case.

To get an unlimited number of splits, "".split(s,-1) is a sensible choice. But in this case re.split(r,s,-1) performs zero splits.

Where's the sense in this?

>>> import string, re
>>> string.split("foo bar baz"," ",0)
['foo bar baz']
>>> re.split("\s+","foo bar baz",0)
['foo', 'bar', 'baz']
>>> string.split("foo bar baz"," ",-1)
['foo', 'bar', 'baz']
>>> re.split("\s+","foo bar baz",-1)
['foo bar baz']
History
Date User Action Args
2011-11-05 02:46:36acgsetrecipients: + acg
2011-11-05 02:46:36acgsetmessageid: <1320461196.01.0.560612390683.issue13346@psf.upfronthosting.co.za>
2011-11-05 02:46:35acglinkissue13346 messages
2011-11-05 02:46:34acgcreate