Working around a lack of 'goto' in python

Donn Cave donn at u.washington.edu
Mon Mar 8 18:28:14 CET 2004


In article <36gth1-42c.ln1 at home.rogerbinns.com>,
 "Roger Binns" <rogerb at rogerbinns.com> wrote:
> > This has to be the worst idea I've seen in a long time.
> 
> Well, it is popular enough to be in shell scripting (digit
> form), several forms of Basic (either form), another poster
> mentioned ADA, and I have seen it in other languages which
> I have forgotten.

This is an argument for it, or against?

> Note that your mental model is one of "I want to continue/break
> *that* loop".  When *that* is the enclosing loop, break/continue
> is easy.  When it is outside the enclosing loop, you then have
> to figure out how to transfer control to the appropriate
> location using exceptions, state variables and who knows
> what else.

Don't forget "return".

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list