[Python-ideas] if condition: break idiom

Josiah Carlson josiah.carlson at gmail.com
Mon Sep 22 03:21:31 CEST 2008


On Sun, Sep 21, 2008 at 3:13 PM, Arnaud Delobelle
<arnodel at googlemail.com> wrote:
> There's a missing 'return' in my last post!
>
> On 21 Sep 2008, at 22:10, Arnaud Delobelle wrote:
>
>> def foo(...):
>>   while True:
>>       if error_condition1:
>>           break
>>       # Other error conditions, processing, etc
>>       # only executes if everything is OK
>
>        return
>>
>>   # Error condition

Short answer: there are many variants, not all of them can be
translated into the above.

 - Josiah



More information about the Python-ideas mailing list