These functions have been taken from the recipes in the Python documentation for itertools. They were originally written by Raymond Hettinger and various other people.
This license applies to the Python documentation.
The idea to collect all of the itertools recipes into a module named iterutils is from this post by Alex Martelli.
Because iterutils has been packaged for pypi, it can be installed using:
$ pip install iterutils
After iterutils has been installed, its functions can be imported and used as follows:
>>> import iterutils >>> list(iterutils.pairwise('abc')) [('a', 'b'), ('b', 'c')]
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.