Skip to content

Z-Shang/pyttern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages