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 "user-defined" starting index.
Actually the next starting position will be build upon the last starting position (of found sep.) + separator length + 1. It should be possible to manipulate the next starting index by changing this behavior into: last starting position (of found sep.) + separator length + OFFSET. NOTE: The slicing start index (for substring) stay untouched. This will help us to solve splitting sequences with one or more consecutive separators. The following demonstrates the actually behavior. >>> s = 'abc;;def;hij' >>> s.split(';') ['abc', '', 'def', 'hij'] This works fine for both str/bytes values. The following demonstrates an "offset variant" of split function. >>> s = 'abc;;def;hij' >>> s.split(';', offset=1) ['abc', ';def', 'hij'] The behavior of maxcount/None sep. parameter should be generate the same output as before. A change will be affect (as far as I can see): - split.h - split_char/rsplit_char - split/rsplit ---------- messages: 226564 nosy: cwr priority: normal severity: normal status: open title: Adding manually offset parameter to str/bytes split function type: enhancement versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22360> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com