Skip to content

A switch "statement" for Python.

Notifications You must be signed in to change notification settings

etam/switch4python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A switch "statement" for Python.

x = 5

with switch(x) as case:
    if case(4):
        assert False
    if case(5):
        assert True
        case.fallthrough()
    if case(lambda x: x > 3):
        assert True
    if case(6):
        assert False
    if case.default():
        assert False

Tests and usage in test.py.

About

A switch "statement" for Python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%