-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeff Mo
committed
Apr 25, 2019
1 parent
90d3b49
commit 1a4b724
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# laziter | ||
Lazy iterators for Python 3, in the spirit of LINQ or Java Stream. Has easy multithreading built in | ||
|
||
# Installation | ||
Simply `pip install laziter`. It's lightweight and has no dependencies (if you choose not to use the `pathos` multiprocess implementation) | ||
|
||
# Usage | ||
```py | ||
from laziter import laziter | ||
import time | ||
|
||
def sleeper(x): | ||
time.sleep(2) | ||
return x | ||
|
||
lz = laziter([2, 3, [range(1000), 90], 9]) | ||
|
||
lz2 = (lz | ||
.flatten() | ||
.filter(lambda a: a % 2) | ||
.skip(998) | ||
.take(4) | ||
.map(lambda x: x * x) | ||
.parmap(sleeper) | ||
) | ||
|
||
print(sum(lz2)) | ||
print(list(lz2[2:4])) | ||
``` | ||
|
||
# Documentation | ||
|
||
[https://laziter.readthedocs.io](https://laziter.readthedocs.io) | ||
|
||
|