[Python-ideas] Yet Another Switch-Case Syntax Proposal

João Bernardo jbvsmo at gmail.com
Sun Apr 20 06:30:08 CEST 2014


Python already supports switch...case statements.

with switch(foo) as case:
    with case(10):
        print('foo is 10')
    with case.in_(15, 16, 17):
        print('foo might be 15 or 16 or 17')
    with case.default:
        print('Whatever...')

You just need to implement the switch and case things to match the code
above... Also, an if..elif..else block will be simpler to use
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140420/662d21ae/attachment.html>


More information about the Python-ideas mailing list