Skip to main content

Irritable implements broken iterators called irritables

Project description

Irritable

https://img.shields.io/pypi/v/irritable.svg https://img.shields.io/travis/timb07/irritable.svg Documentation Status Updates

Irritable implements broken iterators called irritables

Features

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;

Credits

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.

History

0.1.0 (2017-08-08)

  • First release on PyPI.

Project details


Download files

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

Source Distribution

irritable-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

irritable-0.1.0-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file irritable-0.1.0.tar.gz.

File metadata

  • Download URL: irritable-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for irritable-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d0e4084e074b18042115aa6dac2e8bcec5612a1f6373d4d9194cd4894983311a
MD5 c5f2491e04da8c244fa19b665b4c9863
BLAKE2b-256 0affa5acbdf26ff2edbe6d37fe9de7ec06d8c4ba0a84bbfb21492df00037a0e6

See more details on using hashes here.

File details

Details for the file irritable-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for irritable-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d6091be1967c32aab5b670d1917c32e6580e691a8078ba6906174c71eb4581b8
MD5 2c0af357020ad41f9f9fffcc97db8320
BLAKE2b-256 79610f1f7d94defca7c78a43282894d3dd11050926697e4a9b24020bfcd4ae0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page