[docs] [issue12490] Documentation for itertools.chain.from_iterable is incorrect

Rodolpho Eckhardt report at bugs.python.org
Mon Jul 4 22:42:12 CEST 2011

New submission from Rodolpho Eckhardt <rodolpho.eckhardt at gmail.com>:

The documentation at http://docs.python.org/py3k/library/itertools.html#itertools.chain and http://docs.python.org/library/itertools.html#itertools.chain is inconsistent.

At the definition of the class it states that itertools.chain.from_iterable can receive one iterable "Gets chained inputs from a single iterable argument that is evaluated lazily.", but then it contradicts itself by using the following example:

def from_iterable(iterables):
    # chain.from_iterable(['ABC', 'DEF']) --> A B C D E F
    for it in iterables:
        for element in it:
            yield element

This example could lead the reader to believe this alternative constructor can receive multiple iterable objects, when in fact it can receive only one.

assignee: docs at python
components: Documentation
messages: 139802
nosy: RodolphoEckhardt, docs at python
priority: normal
severity: normal
status: open
title: Documentation for itertools.chain.from_iterable is incorrect
versions: Python 2.7, Python 3.2

Python tracker <report at bugs.python.org>

More information about the docs mailing list