Working around a lack of 'goto' in python

Donn Cave donn at u.washington.edu
Mon Mar 8 17:46:49 EST 2004


In article <nf2vh1-juf.ln1 at home.rogerbinns.com>,
 "Roger Binns" <rogerb at rogerbinns.com> wrote:
...
> Just like multiple-inheritance, this may be of no use to you or
> a construct you feel is too dangerous for your code.  That doesn't
> mean it should be prevented from others using it.
> 
> Several pieces of my code would greatly benefit from break/continue
> of multiple depths.  They currently use extra variables and exceptions
> and have had a tendency to be somewhat buggy due to the extra complexity
> and the mismatch between my mental model and what the language allows.

I believe you'd be able to get the same benefit from goto -
nearly identical solution, really.  Of course it can be used
a lot of other ways, but you couldn't really argue that's a
bad thing, given your position stated above.  I mean, either
Python should incorporate all features that someone finds
useful, and leave taste and judgement to the user, or it
shouldn't.  So it seems like goto is the ticket, following
your line of reasoning.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list