Oct 13, 2017

Python infinite iterators

The itertools package comes with three iterators that can iterate infinitely. 

What this means is that when you use them, you need to understand that you will need to break out of these iterators eventually or you’ll have an infinite loop.

These can be useful for generating numbers or cycling over iterables of unknown length, for example. Let’s get started learning about these interesting iterables!

count(start=0, step=1)

Post a Comment

Featured Post

Modern tar recognizes the file format

One command works with any supported compression method. tar xf archive.tar.xz tar xf archive.tar.gz tar xf archive.tar etc. ...