Yet Another Switch-Case Syntax Proposal

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Apr 3 19:03:40 EDT 2014


On 02/04/2014 15:53, Lucas Malor wrote:
> Hi all. I would proposeto you all a switch-case syntax for Python. I already read PEP 3103 and I'm not completely satisfied by any of the proposed solutions. This is my proposal:
>
> switch_stmt ::=  "switch" identifier "case" expression_list ":" suite
>      ("case" expression_list ":" suite)*
>      ["else" ":" suite]
>
> or, more simply:
>
>
>
> switch x case var1:
>      ....
> case var2:
>      ...
> case var3:
>      ...
> else:
>      ...
>

Please don't take this personally, but there's more chance of me being 
the first ever World President than of anybody getting a switch/case 
statement past the BDFL.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com





More information about the Python-list mailing list