[Python-ideas] copyable iterators, named loops, continue a expression per indentation and a few functional things

Mathias Panzenböck grosser.meister.morti at gmx.net
Wed Dec 27 04:05:11 CET 2006

David Blaschke schrieb:
> Using break for parent, grandparent, etc. only works until someone
> modifies the code incorrectly.  It is a problem waiting to happen. 
> Mathias' suggestion breaks the outer loop, but a slight modification
> allows you to break any one of the loops
> "Well this is a good way to break the outer most loop without any new
> syntax:"
>     cond1 = 1
>     cond2 = 1
>     cond3 = 1
>     while cond1:
>         while cond2:
>            while cond3:
>                if cond4:
>                    cond2 = 0         ## break second loop, etc

of course you could do it this way. then you could also say, what is "break" and "continue" good for
at all? I think its a matter of taste (not good or bad taste, just different)

More information about the Python-ideas mailing list