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
Release files for py-ttern 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py-ttern-0.0.6.tar.gz | 5.2 kB | Details |
Release files / py-ttern-0.0.6.tar.gz
| Download URL | py-ttern-0.0.6.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
624db87cba33d7583c587c20e687cc81f2feb204853d17d92e6419bcb4530862
|
|
BLAKE2b-256 checksum How to use checksums |
c5ed4c02246a94d121173353f0048bd7112c093dbea2d163a1bdd7e9ec10dfd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|