Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

itertools. But picklable.

Project Description

A reimplementation of the Python standard library’s itertools, in Python, using picklable iterator objects. Intended to be Python 2.7 and 3.4+ compatible.


  • Because the standard library pickle module (nor the excellent dill package) can’t serialize all of the itertools iterators.
  • Because there are lots of instances where these things in itertools would simplify code, but can’t be used because serializability must be maintained. Primarily blocks is our first consumer.


  • This should be a drop-in replacement. Pretty self-explanatory. Test against the standard library itertools or builtin implementation to verify behaviour matches.
  • Handle built-in types gracefully if possible. List iterators, etc. are not picklable on Python 2.x, so we provide an alternative implementation. File iterators are handled transparently as well. set and dict iterators demand a bit more thought.
  • Premature optimization is the root of all evil. These things are implemented in Python, so speed is obviously not our primary concern. Several of the more advanced iterators are constructed by chaining simpler iterators together, which is not the most efficient thing to do but simplifies the code a lot. If it turns out that speed (or a shallower object graph) is necessary or desirable, these can always be reimplemented. Pull requests to this effect are welcome.

Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(6.4 kB) Copy SHA256 Hash SHA256
Source Feb 13, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting