How to break out of two nested for loops?
Kragen Sitaker
kragen at pobox.com
Tue Jan 22 15:29:02 EST 2002
Dale Strickland-Clark <dale at riverhall.NOTHANKS.co.uk> writes:
> 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.
What are you talking about? It's more misleading, obscure, and
awkward. While goto has its drawbacks, those are not usually among
them.
> 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.
Me too, and it usually improves the code; but it's important to be
aware of the ways your language directs your thinking.
More information about the Python-list
mailing list