Another stab at a "switch/case" construct (for Python 3000):
Jeff Shannon
jeff at ccvcorp.com
Thu Mar 28 14:19:18 EST 2002
Ken Peek wrote:
> A clause can be forced to 'fall through' with the use of a
> 'continue' statement, which jumps to the first statement in the
> next match clause (because 'falling through' IS useful
> sometimes.)
I don't think I like this re-use of the 'continue' keyword -- it seems to me
that the sense, in this context, is considerably different than the sense of
its use in a loop. In a loop, it means "start over from the top", where
here, it means "run this one next bit too, but not anything else".
I'm not sure that falling through is a necessary idiom to accommodate. If
the code that should be used for more than one case is significant enough to
be worth adding a 'continue' to get to, then it most likely is a good
candidate for extraction as a separate function that can be painlessly
called from both cases.
(My $0.02, anyhow.)
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list