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
    following occurs:

    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 :-).

Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/WSLKC3HVHH4L7FJ6Z6GZEOV3KEPDWO7N/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to