Welcome to loop
Replace common looping boilerplate with pretty method chaining.
Installation
pip install loop-python
Documentation
Visit the documentation site.
Example
Loop over range(20), apply the fibo() function and then, on top of it, apply the fizzbuzz() function, finally, apply print():
from loop import loop_over
def fizzbuzz(x):
rules = {3: 'fizz', 5: 'buzz'}.items()
res = ''.join(word for div, word in rules if x%div == 0)
return res if res else x
def fibo(x):
a, b = 1, 1
for _ in range(1, x):
a, b = b, a + b
return b
loop_over(range(20)).map(fibo).map(fizzbuzz).map(print).exhaust()
Will produce the following output:
1
1
2
fizz
buzz
8
13
fizz
34
buzz
89
fizz
233
377
buzz
fizz
1597
2584
4181
fizzbuzz
Metadata
Release files for loop-python 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| loop-python-0.4.0.tar.gz | 16.7 kB | Without provenance | Details for loop-python-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loop_python-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for loop_python-0.4.0-py3-none-any.whl |
Total release size: 26.1 kB
Release files / loop-python-0.4.0.tar.gz
| Download URL | loop-python-0.4.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec461126977a7809524b2f5f5946d930444bbb7bf4e4a79a262de4bca5ce210b
|
|
BLAKE2b-256 checksum How to use checksums |
61ddfdbd6ea33d2096b1b497ed4b0dd4911c3264cac047cc31209ef4a2b95386
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / loop_python-0.4.0-py3-none-any.whl
| Download URL | loop_python-0.4.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a53dcfd55d0ce75e4fb9a1a7a09eb397fe032b7a7847e0bb77cbf681e27bd08a
|
|
BLAKE2b-256 checksum How to use checksums |
76e63a623a31aa361822a0b88506f40e0bf0cee75a29efe2b6cbec9e375eb8e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for loop-python 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.