The itertools module contains special functions to create iterators for efficient looping. It has three broad categories of iterators - infinite iterators, iterators terminating on the shortest input sequence and combinatoric iterators. We will see the usage of some of them in the upcoming sections:
Infinite iterators
count() cycle() repeat()
Iterators terminating on the shortest input sequence
accumulate() chain() compress() dropwhile() filterfalse() groupby() islice() pairwise() takewhile() tee() zip_longest()
Combinatoric iterators
combinations() combinations_with_replacement() permutations() product()
COLOR_ITER = itertools.cycle(["red", "green", "blue", "black", "yellow", "pink", "purple", "cyan"]) ...... m.color(next(COLOR_ITER))