Skip to main content

Module to create composable predicates

Project description

Documentation Test codecov

Introduction

py-predicate is a Python library to create composable predicates

Example

    filtered = [x for x in range(10) if x >= 2 and x <= 3]

Version with predicates:

    ge_2 = ge_p(2)
    le_3 = le_p(3)

    between_2_and_3 = ge_2 & le_3
    filtered = [x for x in range(10) if between_2_and_3(x)]

Of course this example looks way more complicated than the original version. The point here is that you can build reusable predicates that can be used in multiple locations

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

py_predicate-0.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

py_predicate-0.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file py_predicate-0.1.tar.gz.

File metadata

  • Download URL: py_predicate-0.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for py_predicate-0.1.tar.gz
Algorithm Hash digest
SHA256 6a5f275a636422953d453c8313df2e1a7485a72c29cb5652e219d38f91659927
MD5 655185c35d3b070283036d3da0fb0eeb
BLAKE2b-256 13fdc1dbea6a3eb97872551d5c519a0019114d957cede3328c9f14e90799c56e

See more details on using hashes here.

File details

Details for the file py_predicate-0.1-py3-none-any.whl.

File metadata

  • Download URL: py_predicate-0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for py_predicate-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 188cd4b4c52dfcf5b793808aa2571a67e6c04f44244f7b5dd4d0113adef11f9d
MD5 ee61e43311a6e9051daaf42927d7ec9f
BLAKE2b-256 7c817fb2fbed3482b77fd76080641889c2b9f5e59c56e667982cf23b5511d97e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page