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.
Project description
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()
# ['HELLO', 'WORLD']
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()
# [('I', 2), ('dont', 1), ('want', 2), ('to', 2), ('believe', 1), ('know', 1)]
# use tqdm
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.
-
You no need to read API documention. all functions are listed by the code completion as follows.
-
All documentions are showed as follows.
Similar libraries
Note that none of the following libraries are providing full strong typing for code completion.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyiter-0.12.0.tar.gz
.
File metadata
- Download URL: pyiter-0.12.0.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd4fd6377ec5f26271bb7e6625b7b448cc9cdc5b44ce1590ced99785aa4faccd |
|
MD5 | 28f3748aeef935b5d60c25c8c0bd144a |
|
BLAKE2b-256 | dfe36344c3502cc0393bd0e75e283fadd998c437ebdfb9b99e4662b880c716f9 |
File details
Details for the file pyiter-0.12.0-py3-none-any.whl
.
File metadata
- Download URL: pyiter-0.12.0-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a21f39da4e698431d205e528cabcec943d7347c980c1b50cd4051d581f61099f |
|
MD5 | 3b98ba9acf776e4dbe1c18a51ff70e4d |
|
BLAKE2b-256 | b6d25133c7eb94fd154d8f5816ff7185ffd5772fd64e2d13c0e3fba72b639e25 |