empty clause of for loops
Terry Reedy
tjreedy at udel.edu
Wed Mar 16 12:20:45 EDT 2016
On 3/16/2016 11:17 AM, Sven R. Kunze wrote:
> On 16.03.2016 16:02, Tim Chase wrote:
>> Does it annoy me when I have to work in other languages that lack
>> Python's {for/while}/else functionality? You bet.
>
> I can imagine that. Could you describe the general use-case? From what I
> know, "else" is executed when you don't "break" the loop. When is this
> useful?
When one wants to know if the iterable contained an exceptional item or
not or when one wants to know if the iterator is exhausted or not.
--
Terry Jan Reedy
More information about the Python-list
mailing list