py-switchcase

Switches in Python


License
MIT
Install
pip install py-switchcase==0.1.0

Documentation

Switchcase

Switch cases in python that aren't too weird.

Usage

from switchcase import switch

with switch(value) as case:

    with case("foo"):
        assert False

    with case("bar"):
        assert False

    # default case must be last
    with case.default:
        print(":^)")

Installation

py-switchcase is available on pypi.

pip install py-switchcase