[Tutor] for -- else: what was the motivation?

Sibylle Koczian nulla.epistola at web.de
Mon Oct 10 07:41:03 EDT 2022


Am 09.10.2022 um 12:49 schrieb Sibylle Koczian:
> Am 08.10.2022 um 06:13 schrieb Dan Stromberg:
>> The else is executed if you don't "break" out of the loop early.
>>
>> It cuts down on boolean flags.
>>
> 
> Which means that "for -- else" can't be useful for a loop without a
> "break" in it - and the OP's examples didn't have breaks.
> 

Sorry - this should have gone to the general Python mailing list. 
Confused the "for -- else:" thread there with the "if else statement" 
thread here.




More information about the Tutor mailing list