[issue7764] Doc for itertools recipe consume is complicated and less efficient
Peter Otten
report at bugs.python.org
Sat Jan 23 18:29:12 CET 2010
Peter Otten <__peter__ at web.de> added the comment:
As noted on comp.lang.python the implementation can be simplified to
def consume(items, n):
next(islice(items, n, n), None)
When I suggested the above I wasn't aware that
consume(items, None)
should exhaust the entire iterator. Unfortunately I've not found an elegant way to add that functionality.
----------
nosy: +potten
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7764>
_______________________________________
More information about the Python-bugs-list
mailing list