Skip to main content

Functional pipeline library for Python

Project description

A library to add a neat, readable, functional pipeline syntax to Python.

It allows you to rewrite messy nested function calls such as this:

title_sanitized =
  replace(replace(replace(lowercase("Lorem Ipsum Dolor 2018/02/18"), " ", "_"), "/", "-"), "@", "at")

title_sanitized # -> "lorem_ipsum_dolor_2018-02-18"

In a far more readable format like this:

title_sanitized = (
  "Lorem Ipsum Dolor 2018/02/18"
    >> f.lowercase
    >> f.replace("/", "-")
    >> f.replace(" ", "_")
    >> f.replace("@", "at")
)

title_sanitized # -> "lorem_ipsum_dolor_2018-02-18"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypework-0.8.tar.gz (2.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page