[issue17343] Add a version of str.split which returns an iterator
Martin Winks
report at bugs.python.org
Sun Jan 3 09:23:20 EST 2021
Martin Winks <cat at snejugal.ru> 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 objects.
writing regular expressions for different separators/data would be a quite overheadish, so the idea of one-case solution doesn't seem to go very far and requires a bigger change in code for different separators.
let's try to revive this one :)
----------
nosy: +uwinx
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue17343>
_______________________________________
More information about the Python-bugs-list
mailing list