Issue 1504199: Switch syntax (partial PEP 275) (original) (raw)
Attached is a partial implementation of PEP 275.
It should offer a slight performance enhancement over if/elif/else, although it won't be nearly as fast as a lookup table generated at compile time (as the PEP suggests). However, it is more flexible than a compile-time generated lookup table in that it accepts expressions - not just constants - for each case clause.
No new opcodes were added.
Cheers, Tom