Mathew Elman writes:
> Frankly, saying that a part of a language that is frequently
> misunderstood, is *never* allowed to be improved is disappointing
> when the suggestion that it can be (somehow) has been so well
> received by everyone else.
The highly improbable is frequently well-received.
What can surely be improved is the documentation, specifically the
Tutorial. Something like
The else clause of a loop statement has frequently been
misunderstood. In a for or while loop *statement*, on each
iteration, the condition is tested and exactly one of the
1. If truthy, the loop *suite* runs to completion and the test is
repeated for the next iteration,
2. OR the loop *suite* runs and there is a nonlocal exit such as
return or break or raise, which exits the statement as well.
3. OTHERWISE the condition is false, and the else suite, if any,
runs, then the statement is exited.
The emphasis is for contrast in this discussion. The Language
Reference already says precisely this, although much more concisely.
I don't expect supporters of "elif not break" etc to think this is
sufficient, and supporters of the Else Ban similarly. Please consider
if this is helps clarify the Tutorial, and if it doesn't get booed
into oblivion, I'll work up a patch (I think that the section on
control flow would benefit from some reorganization as well, "just
stick it in somewhere" is not what I have in mind :-).
This email is confidential and may contain copyright material of members of the Ocado Group. Opinions and views expressed in this message may not necessarily reflect the opinions and views of the members of the Ocado Group.
If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses.
References to the "Ocado Group" are to Ocado Group plc (registered in England and Wales with number 7098618) and its subsidiary undertakings (as that expression is defined in the Companies Act 2006) from time to time. The registered office of Ocado Group plc is Buildings One & Two, Trident Place, Mosquito Way, Hatfield, Hertfordshire, AL10 9UL.