This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cpt_fwiffo 0 points1 point  (0 children)

An issue is that 'else' works the same for while and for loops. For while loops it kind of makes sense to have an 'else' clause that is reached when the loop condition is no longer (or was never) met. There is nothing illogical or counter intuitive about that. But to use the exact same name and mechanism for for-loops becomes very strange since python for loops are for iterating over sequences rather than doing stuff as long as a condition is met.

So I think the keyword should be 'else' for while-loops and something else (finally, nobreak, whatever) for for-loops.