Skip to main content

plinn: Partition Like It's 1999

PyPI version

The partition function

This module implements a function called "partition."

It is an optimized version of the following python function:

def partition(pred, it):
    f = []
    t = []
    for item in it:
        (t if pred(item) else f).append(item)
    return f, t

Benchmarks

Here are some benchmarks on my i7-6600U laptop with python 3.9.0 comparing against several pure-python variants of the same function:

Variant Time for 32 iterations (seconds)
stdlib 3.2970685160253197
mariy 3.5445828151423484
trevor 2.6459597239736468
byers 2.3595181389246136
scara 2.2327406019903720
scara2 2.1951448819600046
plinn 1.5203454510774463

Release files for plinn 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plinn 0.0.2
File Size Uploaded
plinn-0.0.2.tar.gz 8.8 kB Details

Release files / plinn-0.0.2.tar.gz

Download URL plinn-0.0.2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
884cb06592390e27499b16f7a34c90940c43e6a0a3ef92f3ab4074cab5d8bb81
BLAKE2b-256 checksum
How to use checksums
4410e690b9a6c1b9ef8f2a3adce9f0bea737d188bc4005949c314cca178d7c42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.7.0 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

1 release file

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