MemotivaComprehensions and functional tools

What does itertools.chain do?

Comprehensions and functional tools

Audio flashcard · 0:14

Nortren·

What does itertools.chain do?

0:14

Chain takes multiple iterables and produces their elements in sequence, as if they were a single iterable. It is the lazy equivalent of concatenating lists. Chain.from_iterable takes a single iterable of iterables and chains them, useful for flattening one level.
docs.python.org