[New-bugs-announce] [issue24624] Itertools documentation says iterator when iterable is intended

Neil Girdhar report at bugs.python.org
Mon Jul 13 03:37:26 CEST 2015


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 at python
components: Documentation
messages: 246676
nosy: docs at 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 <report at bugs.python.org>
<http://bugs.python.org/issue24624>
_______________________________________


More information about the New-bugs-announce mailing list