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 details)

Uploaded Source

File details

Details for the file py-ttern-0.0.6.tar.gz.

File metadata

  • Download URL: py-ttern-0.0.6.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for py-ttern-0.0.6.tar.gz
Algorithm Hash digest
SHA256 624db87cba33d7583c587c20e687cc81f2feb204853d17d92e6419bcb4530862
MD5 98870da0df895204df40f797467b9da5
BLAKE2b-256 c5ed4c02246a94d121173353f0048bd7112c093dbea2d163a1bdd7e9ec10dfd0

See more details on using hashes here.

Supported by

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