Iteration Modules
itertools
Composable lazy iterator factories for finite and infinite sequences. Some factories retain pools or buffers, so laziness does not imply constant memory. Bound infinite traversal.
Formal Syntax & Structure
python syntaxpython
itertoolsReturn Value
module
Module object available through import.
Working Example
Example Snippetpython
import itertoolsprint(list(itertools.islice(itertools.count(10),3)))