Steven D'Aprano writes:
On Wed, Jul 22, 2020 at 06:14:39AM +0300, Paul Sokolovsky wrote:
But no, loop executes, *or else* the following "else" block executes ;-).
He means the loop *suite* executes (this includes "getting to" a break statement or other control flow that leaves the loop *statement* entirely), and if it doesn't, the else suite does. This is "why" such nonlocal exits differ from finally in that they don't run the else suite.
I personally think this is a perfectly clear and convincing argument for "else" as the keyword for this statement (once "suite" is added to Paul's phrasing).
This is why programmers should major in English, and do a graduate degree in programming if they really think they need a degree in programming.
You literally say that the loop runs, *or else* (xor) the else block runs. But you say this in response to a demonstration that the loop runs, *and* the else block runs.
You mean "the part of the loop *statement* that starts with 'for' or 'while'" runs, but this is somewhat inconsistent as the else suite is also part of the loop statement. I don't know of a concise but explicit way to express what you mean, although I understood it perfectly well.