albshady / iter_model

iter_model uses a method approach instead of individual functions to work with iterable objects.

Home Page:https://volodymyrbor.github.io/iter_model/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IterModel

Supported Python versions Package version Test

Supported Versions Supported Versions Supported Versions Supported Versions


iter_model - provides a convenient API for interacting with iterable objects (Iterable). iter_model uses a methods approach instead of individual functions.

iter_model also provides async analog of all methods. This is useful when interacting with asynchronous iterable objects (AsyncIterable), because python does not have ready functions for these cases.

Therefore, iter_model provides SyncIter class for Iterable, and AsyncIter for AsyncIterable.


Example

from iter_model import SyncIter

it = SyncIter(range(10))  # SyncIter for sync iterables
result = (
    it.where(lambda x: x % 2 == 0)  # filter only odd values
    .take(3)  # take first 3 value
    .map(lambda x: x ** 2)  # square all values
)
print(result.to_list())

Links

Source code: github.com/VolodymyrBor/iter_model

Documentation: iter_model

Changelog: changelog

About

iter_model uses a method approach instead of individual functions to work with iterable objects.

https://volodymyrbor.github.io/iter_model/

License:MIT License


Languages

Language:Python 99.6%Language:Makefile 0.4%