[Python-ideas] Another idea for a switch statement

Nick Coghlan ncoghlan at gmail.com
Wed Oct 12 08:28:42 CEST 2011


On Wed, Oct 12, 2011 at 8:15 AM, Chris Rebert <pyideas at rebertia.com> wrote:
> On Tue, Oct 11, 2011 at 7:33 AM, Lucas Malor <rwwfjchuws at snkmail.com> wrote:
>> Hello all. I read PEP 275 but I don't like the syntax of examples.
>
> I doubt PEP 275 or PEP 3103 were rejected based just on syntax grounds.

Indeed, they were not. PEP 3103 elaborates on the wide range of design
decisions that need to be made in crafting a switch statement for
Python. For most of them, all of the available options have some
significant downsides. Add in the fact that the desire to use a long
if/elif chain in Python often suggests a deeper architectural problem
in the relevant code (usually something like "when using Python, write
Python, not C"), the idea of adding a new and complicated construct to
the language for such a niche use case doesn't garner much support.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list