[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-12 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22360 ___

[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Christoph Wruck
New submission from Christoph Wruck: Currently we have a split function which splits a str/bytestr into chunks of their underlying data. This works great for the most tivial jobs. But there is no possibility to pass an offset parameter into the split function which indicates the next

[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm afraid I don't understand the purpose of this feature request, or what the behaviour is. You show a simple example: s = 'abc;;def;hij' s.split(';', offset=1) ['abc', ';def', 'hij'] but I don't understand why you want to keep the second semi-colon. I

[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Such problems are solved by using regular expressions. re.findall('(?:^|(?=;)).?[^;]*', 'abc;;def;hij') ['abc', ';def', 'hij'] -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org

[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Christoph Wruck
Christoph Wruck added the comment: Hi Steven exactly - you're right with this. 'spam--eggs--cheesetoast'.split('-', offset=1) -- ['spam', '-eggs', '-cheese', '-', '-toast'] 'spam--eggs--cheese--toast'.split('-', offset=8) -- ['spam', '-eggs--cheese', '-toast'] Okay - the name offset

[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread R. David Murray
R. David Murray added the comment: If you want to do complex splitting, the supported way to do so is re.split. Feel free to take this to python-ideas if you think there is sufficient reason for baking a particular additional splitting functionality into str.split. -- nosy:

[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Christoph Wruck
Christoph Wruck added the comment: Serhiy, you will be right if you've to split a complex string such spliting strings with more than one separator. In this case I would prefer a regex bases solution too. Otherwise we could actually use the re-lib for every of those jobs without using the

[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Christoph Wruck
Christoph Wruck added the comment: David, I'll reflect on it. @ALL - Thank's for all answers. Should I close this ticket? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22360 ___