Skip to main content

Irritable implements broken iterators called irritables

Project description

Irritable Documentation Status Updates

Irritable implements broken iterators called irritables


Iterators are defined in the docs ; the definition includes what constitutes a broken implementation:

4.5. Iterator Types


Once an iterator’s __next__() method raises StopIteration, it must continue to do so on subsequent calls. Implementations that do not obey this property are deemed broken.

Irritables are like iterables, but deliberately broken. The following types of brokenness are supported:

  • after next() first raises StopIteration, subsequent calls will raise StopIrritation instead;
  • if the irritator is instantiated with resume=True, calling next() may raise StopIteration when items remain still remain in the container; subsequent calls to next() will return the remaining items as usual until none remain;
  • if the irritator is instantiated with repeat=True, after the iterator has been exhausted and raises StopIteration, the iterator is reset and can be iterated over again ad infinitum; in this case next() will never raise StopIrritation;


The idea for irritators came during Trey Hunner’s talk “Loop better: a deeper look at iteration in Python” at DjangoCon AU 2017.

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.


0.1.0 (2017-08-08)

  • First release on PyPI.

Project details

Release history Release notifications

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.

Filename, size & hash SHA256 hash help File type Python version Upload date
irritable-0.1.0-py2.py3-none-any.whl (5.0 kB) Copy SHA256 hash SHA256 Wheel py2.py3
irritable-0.1.0.tar.gz (12.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page