Combines multiple iterables into a single sequence without building a new list in memory. See itertools — Python docs.
from itertools import chain
chain(iterable1, iterable2, ...)- Chaining lists of different types
- Flattening a list of lists with
chain(*list_of_lists) - Memory efficiency —
chainreturns a lazy iterator
python itertools_chain.py