Skip to main content

Python module for simple pattern matching

Project description

Pyttern

Simple ans stupid pattern matching for Python

Usage

With the decorator @pyttern, you can do pattern matching easily with:

@pyttern
def pat(a, b): {
  (1, 2): a,
  (3, 4): b,
  (_1, 5): _1 * 5,
  _ : 100,
}

pat(1, 2) => 1
pat(3, 4) => 4
pat(10, 5) => 50
pat(0, 0) => 100

For a more complex example, check out: Tick

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-ttern-0.0.6.tar.gz (5.2 kB view hashes)

Uploaded Source

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