itertools.chain.from_iterable()
itertools.chain.from_iterable() is a Python function in the Itertools Module category. Alternative chain that takes a single iterable of iterables. The syntax is itertools.chain.from_iterable(iterable). Parameters: iterable of iterables. Returns: Iterator. A typical example: list(chain.from_iterable([[1,2],[3,4]])) # [1,2,3,4]. A close sibling is itertools.chain(), which creates an iterator that returns elements from the first iterable until exhausted, then proceeds to the next. A close sibling is itertools.product(), which cartesian product of input iterables (like nested for-loops). A close sibling is itertools.permutations(), which returns all possible r-length ordered arrangements of elements. A close sibling is itertools.combinations(), which returns all r-length unordered combinations without replacement. More about this category: Iterator building blocks — chain, product, permutations, combinations, groupby. For a broader walkthrough, read the Itertools Module guide. Related Itertools Module entries: itertools.chain(), itertools.product(), itertools.permutations(), itertools.combinations(), itertools.combinations_with_replacement(), itertools.cycle(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.