"rockingred" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Mar 8, 4:15 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > If the sense of else were reversed, one would have to write the clumbsier > > complete = True # though false at this point > while loop_condition: > <loop statements> > if break_condition: > complete = False > break > <more loop stuff> > else: > <break-only statements> > if complete: > <completion-only statements> > > Terry Jan Reedy
Terry, instead of using "complete = True" and setting it to false on failure, why not set "loop_completed = False" and set it to True if the break condition is met? [OE not quoting properly] ===================== Because completion is False when broken? Actually, I am not sure what you mean without seeing the snippet rewritten. Certainly, one could set 'broken=False' at top (tho not true) and 'broken = True' before breaking and test for 'not broken' at end, but that is not an improvement. tjr -- http://mail.python.org/mailman/listinfo/python-list