Working around a lack of 'goto' in python

Roger Binns rogerb at rogerbinns.com
Mon Mar 8 22:28:12 CET 2004


Donn Cave wrote:
> 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?

It is an argument for.  I also looked into Perl and it has named
continues (mostly).  It is obviously useful enough to have been
in several languages.   (I am not saying that all features in
all languages are a good thing, just that something in multiple
languages has some merit).

The lack of this feature in Python (and other languages) means
that people have gotten used to "workarounds" such as using
exceptions and introducing variables.  In the same way you
would be used to using 'while' as a workaround for a language
that didn't have 'for'.

Roger





More information about the Python-list mailing list