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

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.5.tar.gz (5.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: py-ttern-0.0.5.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for py-ttern-0.0.5.tar.gz
Algorithm Hash digest
SHA256 181d3acd47afb75aca4e5f17c6788c423041c75d40d379cc3636405d83ebec2f
MD5 e1528811923b6212956d582b370af1aa
BLAKE2b-256 e18ca22784dad11d0fb30792362dbfeffa66e25376ba676bb749edb62ea3abf2

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