[Python-Dev] switch-based programming in Python

Barry Scott barry.alan.scott@ntlworld.com
Fri, 9 Nov 2001 01:11:37 -0000


The fall through is the source of too many defects in C/C++ code.
And its rarely used in the wild according to report on this subject
a few years ago.

Goto in python would be a terrible thing.

		BArry

-----Original Message-----
From: python-dev-admin@python.org [mailto:python-dev-admin@python.org]On
Behalf Of Paul Svensson
Sent: 08 November 2001 17:44
To: python-dev@python.org
Subject: Re: [Python-Dev] switch-based programming in Python


On Thu, 8 Nov 2001, Eric S. Raymond wrote:

>Skip Montanaro <montanaro@tttech.com>:
>> One other post I saw in this thread used explicit breaks as is required in
>> C.  I would get rid of that.  When the current case's code ends, control
>> flow should just jump to the end of the switch.
>
>I disagree. Such fallthrough is very useful when writing state machines,
>which is a significant part of the utility of a case statement.

+0 on the idea of some kind of switch statement, but
-1 on bringing C's glorified computed GOTO into Python.

Maybe it would be a good idea to use some other keyword(s),
so as to avoid confusion with C altogether,
e.g select/when instead of switch/case.

	/Paul


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev