Skip to content

Repository files navigation

iterum

Iterum logo

PyPI - Version PyPI - Python Version project - uv

linting - Ruff types - Pyright License - MIT


Rusty iterators in Python.

Installation

pip install iterum

Documentation

The documentation is made with Zensical and is hosted by GitHub Pages.

Example

from iterum import iterum, Some, nil, seq

itr = iterum([1, 2])
assert itr.next() == Some(1)
assert itr.next() == Some(2)
assert itr.next() == nil

itr = iterum([1, 2, 3, 4])
assert itr.fold(0, lambda acc, x: acc + x) == 10

lst = (
    seq(5)
    .map(lambda x: x**2 + 1)
    .filter(lambda x: x % 2)
    .collect()
)
assert lst == [1, 5, 17]

License

iterum is distributed under the terms of the MIT license.

About

Rusty iterators in python

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages