How to break out of two nested for loops?

Dale Strickland-Clark dale at riverhall.NOTHANKS.co.uk
Mon Jan 21 20:25:00 EST 2002


Tom Jenkins <tjenkins at devis.com> wrote:

>
>well an easy way to break out of n loops is using an exception.

This solution keeps cropping up but, IMHO, using an *exception* for
something that isn't an exception is just as obscure, misleading and
awkward as a goto.

So far, I have found that I can always code around the need to break
out of nested loops without nasty constructs, exceptions or flags by
using functions, classes or the 'else' clause.
--
Dale Strickland-Clark
Riverhall Systems Ltd



More information about the Python-list mailing list