How to break out of two nested for loops?
Bengt Richter
bokr at oz.net
Fri Jan 25 17:34:40 EST 2002
On Fri, 25 Jan 2002 12:28:30 -0800, Cliff Wells <logiplexsoftware at earthlink.net> wrote:
>On Fri, 25 Jan 2002 14:58:33 +0100
>Alex Martelli wrote:
>
>> "Laura Creighton" <lac at strakt.com> wrote in message
>> news:mailman.1011889735.22267.python-list at python.org...
>> > Last night I got to thinking that instead of _except_
>> > what I would like as the keyword is _discover_
>>
>> Cool. Or maybe 'expect' -- a mental-typo I do make
>> sometimes for 'except' when I am _expecting_ the
>> _exception_ to happen...:-).
>>
>
>In that case, how about "unless" rather than "else" ?
>
>try:
> MyFunction()
>expect DismalFailure:
> print "Figures."
>unless:
> print "It worked!"
>
Better yet, "otherwise:"
Regards,
Bengt Richter
More information about the Python-list
mailing list