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 steven.daprano
Recipients cwr, steven.daprano
Date 2014-09-08.10:29:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1410172158.9.0.255448822483.issue22360@psf.upfronthosting.co.za>
In-reply-to
Content
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 would have thought this would be more useful:

# treat runs of the separator as if it were a single separator
['abc', 'def', 'hij']


It might help if you explain under what circumstances you would use this. Also, how does the caller choose a value for offset? Say, I read a string from a data file, or from the user. How do I know what offset to use?

I'm not sure I understand what this offset parameter is supposed to do in general. Here are some examples showing what I think you want, can you tell me if I'm right?

'spam--eggs--cheese----toast'.split('-', offset=1)
--> ['spam', '-eggs', '-cheese', '-', '-toast']


'spam--eggs--cheese--toast'.split('-', offset=8)
--> ['spam', '-eggs--cheese', '-toast']
History
Date User Action Args
2014-09-08 10:29:18steven.dapranosetrecipients: + steven.daprano, cwr
2014-09-08 10:29:18steven.dapranosetmessageid: <1410172158.9.0.255448822483.issue22360@psf.upfronthosting.co.za>
2014-09-08 10:29:18steven.dapranolinkissue22360 messages
2014-09-08 10:29:18steven.dapranocreate