[Python-Dev] PEP 3103: A Switch/Case Statement

Josiah Carlson jcarlson at uci.edu
Wed Jun 28 09:23:45 CEST 2006

Talin <talin at acm.org> wrote:
> My version of this is to add to Python the notion of a simple 
> old-fashioned subroutine - that is, a function with no arguments and no 
> additional scope, which can be referred to by name. For example:

I don't like the idea of an embedded subrutine for a few reasons.  One
of them is because you need to define the case -> sub mapping
dictionaries in each pass, you are getting no improvement in speed
(which is a motivating factor in this discussion).  Even worse, the
disconnect between case definition and dispatch makes it feel quite a
bit like a modified label/goto proposal.  The ultimate killer is that
your proposed syntax (even using def) make this construct less readable
than pretty much any if/elif/else chain I have ever seen.

 - Josiah

More information about the Python-Dev mailing list