f_it
Iterator class for functional-esque, postfix-chaining programming.
Features
- A single wrapper class exposing chain-able methods for lazily transforming iterators
- Wraps functions from
functools,itertools, and some extras - Optionally has a length, which is calculated for subsequent operations if possible
Note that this package is for convenience/ interface comfort purposes
and does not provide the guarantees of a true functional language.
There may be a significant performance overhead to using deeply nested FIt instances in tight loops.
Usage
from f_it import FIt
it = FIt(range(10))
transformed = it.map( # cube elements
lambda x: x**3
).filter( # drop even elements
lambda x: x % 2
).cycle( # repeat the whole iterator 3 times
3
).islice( # take some elements from the middle
5, 10
).chain( # add 0-4 to the end
range(5)
).chunk( # separate into 2-length chunks
2
)
# __add__ and __radd__ are implemented for chaining other Iterators
added = transformed + iter([1, 2, 3])
# nothing has been evaluated yet!
# evaluate operations, reading into a list
# if tqdm is available, show progress bar
as_list = added.progress().to(list)
Metadata
Release files for f-it 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| f_it-0.6.1.tar.gz | 14.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| f_it-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / f_it-0.6.1.tar.gz
| Download URL | f_it-0.6.1.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e57cd594760a875c3dfec984b22f4cfe6225deff24876c0c949a44d55a8265c6
|
|
BLAKE2b-256 checksum How to use checksums |
1f0fefe3c062496dbf4323db1b74b0bd4b725486f6e2ea8c006faee2aa373468
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / f_it-0.6.1-py3-none-any.whl
| Download URL | f_it-0.6.1-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42b996fc97f821309e0f5b17402ceb82a4b3e1fec08fdebf58d6aedaf543bf99
|
|
BLAKE2b-256 checksum How to use checksums |
3801c7f309a582a13d20fa99e524a37c98dde2f3412e3c02bd15781be8454541
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|