[issue44571] itertools: takedowhile()
Tim Peters
report at bugs.python.org
Mon Jul 12 12:40:43 EDT 2021
Tim Peters <tim at python.org> added the comment:
That said, if you really do want those semantics, it's easy to build on top of Raymond's API:
def takewhile_plus_one_more_if_any(pred, iterable):
from itertools import islice, chain
before, after = before_and_after(pred, iterable)
return chain(before, islice(after, 1))
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44571>
_______________________________________
More information about the Python-bugs-list
mailing list