[issue17343] Add a version of str.split which returns an iterator

2021-01-03 Thread Martin Winks
Martin Winks added the comment: > Perhaps the use case is already served by re.finditer() def split_whitespace_ascii(s: str): return (pt.group(0) for pt in re.finditer(r"[A-Za-z']+", s)) solution above does not cover all possible data and is incorrect for bytes-like obje

[issue42816] Add str.split_iter function

2021-01-03 Thread Martin Winks
New submission from Martin Winks : Split string by given separator and return iterator as a result. The naive and not very efficient solution would be using current str.split: def split_iter(self: str, sep: str) -> 'Iterator[str]': return iter(self.split(sep)) Probably, need we'll s