Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

itertools.chain

Combines multiple iterables into a single sequence without building a new list in memory. See itertools — Python docs.

Usage

from itertools import chain
chain(iterable1, iterable2, ...)

Covered

  • Chaining lists of different types
  • Flattening a list of lists with chain(*list_of_lists)
  • Memory efficiency — chain returns a lazy iterator

Run

python itertools_chain.py