Skip to content

mypy complains if itertools.chain.from_iterable is given an iterator, tuple, or list. #521

@fgregg

Description

@fgregg
chunks = ([1] * 3 for _ in range(10))
flattened = itertools.chain.from_iterable(chunks)

Is valid python code, but mypy throws this error:

error: Argument 1 to "from_iterable" of "chain" has incompatible type Iterator[Iterable[...]]; expected Iterable[Iterable[...]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions