O'Reilly logo

Python: Journey from Novice to Expert by Rick van Hattem, Dusty Phillips, Fabrizio Romano

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

itertools

The itertools library contains iterable functions inspired by those available in functional languages. All of these are iterable and have been constructed in such a way that only a minimal amount of memory is required to process even the largest of datasets. While you can easily write most of these functions yourself using a simple function, I would still recommend using the ones available in the itertools library. These are all fast, memory efficient, and—perhaps more importantly—tested.

Note

Even though the titles of the paragraphs are capitalized, the functions themselves are not. Be careful not to accidently type Accumulate instead of accumulate.

accumulate – reduce with intermediate results

The accumulate function is very similar to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required