| name | switchlang |
| description | Adds switch blocks to the Python language. Use when writing Python code that uses the switchlang package.
|
| license | MIT |
| compatibility | Requires Python >=3.9. |
switchlang
Adds switch blocks to the Python language.
Installation
pip install switchlang
API overview
The switch block
The context manager that gives Python an explicit switch statement. Use it in a with block, register cases, then read result.
switch: An explicit switch statement for Python, implemented as a context manager
Range helpers
Helpers for mapping ranges of values to a single case.
closed_range: Create a closed range for a case: both start and stop are included
Resources