Breaking Out

James Kew james.kew at btinternet.com
Fri Aug 23 18:03:04 EDT 2002


"Bradley D. Larson" <blarson at crary.com> wrote in message
news:mailman.1030131895.10485.python-list at python.org...

> I believe a cleaner method is:
>
> while x = y:
>     blah
>     blah
>     blah
>     if break_now:
>         break
>     blah
>     blah
>     blah
>     if break_now:
>         break
>     blah
>     blah
>     blah
> [...]
>     break    # dont forget the last break!

That makes a conditional look like a loop -- not terribly expressive of
intent.

"Skip to the end" and "I WANT OUT" suggest throwing an exception to me...

--
James Kew
james.kew at btinternet.com





More information about the Python-list mailing list