PyIter
PyIter is a Python package for iterative operations inspired by the Kotlin、CSharp(linq)、TypeSrcipt and Rust .
Enables strong typing and type inference for iterative operations.
- Chain operations like map, reduce, filter, map
- Lazy evaluation
- parallel execution
- strong typing
Install
pip install pyiter
Quickstart
from pyiter import it
from tqdm import tqdm
text = ["hello", "world"]
it(text).map(str.upper).to_list()
words = 'I dont want to believe I want to know'.split()
it(words).group_by(lambda x: x).map(lambda g: (g.key, g.values.count())).to_list()
it(range(10)).map(lambda x: str(x)).progress(lambda x: tqdm(x, total=x.len)).parallel_map(lambda x: x, max_workers=5).to_list()
Type inference
API
See API documention.
Similar libraries
Note that none of the following libraries are providing full strong typing for code completion.
License
Licensed under either of
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.