Message246676
In the description of the consume recipe:
def consume(iterator, n):
"Advance the iterator n-steps ahead. If n is none, consume entirely."
# Use functions that consume iterators at C speed.
if n is None:
# feed the entire iterator into a zero-length deque
collections.deque(iterator, maxlen=0)
else:
# advance to the empty slice starting at position n
next(islice(iterator, n, n), None)
iterator should be replaced with iterable. This function accepts strings for example, which are not iterators. |
|
Date |
User |
Action |
Args |
2015-07-13 01:37:26 | NeilGirdhar | set | recipients:
+ NeilGirdhar, docs@python |
2015-07-13 01:37:26 | NeilGirdhar | set | messageid: <1436751446.36.0.0536875668561.issue24624@psf.upfronthosting.co.za> |
2015-07-13 01:37:26 | NeilGirdhar | link | issue24624 messages |
2015-07-13 01:37:24 | NeilGirdhar | create | |
|