New submission from Neil Girdhar:
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.
----------
assignee: docs@python
components: Documentation
messages: 246676
nosy: docs@python, neil.g
priority: normal
severity: normal
status: open
title: Itertools documentation says iterator when iterable is intended
type: enhancement
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue24624>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com