https://github.com/cospectrum/ziper
Rust-like iterator for Python
https://github.com/cospectrum/ziper
Last synced: about 1 year ago
JSON representation
Rust-like iterator for Python
- Host: GitHub
- URL: https://github.com/cospectrum/ziper
- Owner: cospectrum
- License: apache-2.0
- Created: 2023-05-24T02:07:08.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-16T02:34:43.000Z (almost 2 years ago)
- Last Synced: 2025-03-25T04:23:09.914Z (over 1 year ago)
- Language: Python
- Size: 43.9 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ziper
[![github]](https://github.com/cospectrum/ziper)
[github]: https://img.shields.io/badge/github-cospectrum/ziper-8da0cb?logo=github
Rust-like iterator for Python
## Install
```sh
pip install ziper
```
## Usage
```py
from ziper import Iter
xs = ['1', '2', 'a', '3', '4', 'b', 'c']
ys = [6, 7, 8, 9]
evens: list = (
Iter(xs)
.filter(str.isdecimal)
.map(int)
.chain(ys)
.filter(lambda x: x % 2 == 0)
.collect(list)
)
assert evens == [2, 4, 6, 8]
```