I have noticed that switch/case statements are coming to Python, so I thought it would be amusing to release the 101002938662893028482039th "Missing switch/case package" to this platform.
import switchem
MONKEY = 1
ELEPHANT = 2
GIRAFFE = 3
HORSE = 4
SQUIRREL = 5
SQUID = 6
COW = 7
SARCASTIC_FRINGEHEAD = 8
with switchem(HORSE) as case:
if case(MONKEY):
print("It is a monkey")
raise case
if case(ELEPHANT, GIRAFFE, HORSE):
print("It is not a monkey for sure")
if case(SQUIRREL):
print("It could be a squirrel")
raise case
print("It is definitely not a monkey, elephant, giraffe, horse, or squirrel")
This has the fall-through behaviour (fall-through will activate as soon as the correct value is checked). To "break", raise the case object within the context.
Metadata
Release files for switchem 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| switchem-1.0.0.tar.gz | 1.9 kB | Without provenance | Details |
Release files / switchem-1.0.0.tar.gz
| Download URL | switchem-1.0.0.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5aa43800f0022880be0505eee94810d51bee57993e2089e194016398175cb763
|
|
BLAKE2b-256 checksum How to use checksums |
ca7d4eafc2a87cd1d9760b67fb59794c2ef8d606bddeef28110c43a8bdce06a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.4
|
Security for switchem 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.