Behavior of the for-else construct

Tim Chase python.list at tim.thechases.com
Thu Mar 3 11:03:59 EST 2022


On 2022-03-04 02:02, Chris Angelico wrote:
>> I want to make a little survey here.
>>
>> Do you find the for-else construct useful? Have you used it in
>> practice? Do you even know how it works, or that there is such a
>> thing in Python?  
> 
> Yes, yes, and yes-yes. It's extremely useful.

Just adding another data-point, my answer is the same as above.

I use it regularly and frequently wish for it (or a similar "didn't
trigger a break-condition in the loop" functionality) when using
other programming languages.

-tkc





More information about the Python-list mailing list