Skip to main content

Stricter verion of zip.

Project description

Overview

The howe project contains the Howe class. A Howe object is similar to a zip object, except that all the iterators have to run out at the same time. Otherwise an ExceptionGroup (containing the StopIteration exceptions from the iterators that did run out) will be raised. The project is named for E. Howe, one of the intentors of the zipper.

Installation

To install howe, you can use pip. Open your terminal and run:

pip install howe

Implementation

class Howe:
    def __init__(self, *args):
        self._args = [iter(x) for x in args]

    def __iter__(self):
        return self

    def __next__(self):
        elements = list()
        errors = list()
        for arg in self._args:
            try:
                element = next(arg)
            except StopIteration as error:
                errors.append(error)
            else:
                elements.append(element)
        if not len(errors):
            return tuple(elements)
        if len(elements):
            raise ExceptionGroup("Howe failed.", errors)
        raise StopIteration

License

This project is licensed under the MIT License.

Credits

Thank you for using howe!

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

howe-1.0.4.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

howe-1.0.4-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file howe-1.0.4.tar.gz.

File metadata

  • Download URL: howe-1.0.4.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for howe-1.0.4.tar.gz
Algorithm Hash digest
SHA256 4091f578ca354868883ee8a6b297e9638a461a639b9ee5a75a728c095bbb3ecd
MD5 49d661f30d607f2deb2ae26e4b7a2930
BLAKE2b-256 89bf0888713c5d1b6a5653620befbf13d8cdecf6cab21234e1cd44f047a24df5

See more details on using hashes here.

File details

Details for the file howe-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: howe-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for howe-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c373b0a9487fefea3e84b432d79cfecbdc5f4caf8f1cb75d3dd65cc907532425
MD5 55241e77400a1714645e308bc61f6675
BLAKE2b-256 e8595a4a5d2a50ba7ad53af6d8d5ec3b808b2ce0b05c618361220a35d9b42e25

See more details on using hashes here.

Supported by

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