Skip to main content

tests

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

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)

Source distribution for loop-python 0.4.0
File Size Uploaded
loop-python-0.4.0.tar.gz 16.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for loop-python 0.4.0
File Interpreter ABI Platform
loop_python-0.4.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page