I'm really glad that Олег Комлев has posted this suggestion to the list.
Thank you!

I found myself using this construction, and in December 2019 (that seems a
long time ago) I discussed it face-to-face with Paul Piwek. He found this
highly relevant article
https://stackoverflow.com/questions/9979970/why-does-python-use-else-after-for-and-while-loops

Here's a brief (and selective) summary of this SO page. The question was
asked in 2012. The original poster wrote "No matter how I think about it,
my brain can't progress seamlessly from the for statement to the else
block."

One of the answers references a talk by Raymond Hettinger, which "briefly
addresses the history of for ... else". He attributes the concept to Don
Knuth, and says that if Guido was thinking about the future he (GvR) would
have called it no_break instead of else, so everyone would know what it did.

I highly recommend that you watch RH's talk, 15:50 to 19:00 (min:sec).
Transforming Code into Beautiful, Idiomatic Python
https://www.youtube.com/watch?v=OSGv2VnC0go&feature=youtu.be&t=950

The Stackoverflow page also references a summary of earlier discussions
that Steven D'Aprano kindly prepared and posted to this list (in 2009).
https://mail.python.org/pipermail/python-ideas/2009-October/006155.html

That's the end of my SO summary. In addition, there's Don Knuth's paper
    Structured Programming with goto statements (1974)
    Reprinted in https://www-cs-faculty.stanford.edu/~knuth/lp.html

By the way, I happen to have a copy of this book (typeset by TeX, of
course) and have more than once read the 1974 goto paper. (There we go. A
loop with a break.)

If you don't have ready access to a copy, you might like to look at
    http://people.cs.pitt.edu/~zhangyt/teaching/cs1621/goto.slides.pdf
    http://www.kohala.com/start/papers.others/knuth.dec74.html

I think that's enough for now. And thank you again Олег, for posting your
suggestion to the list.

-- 
Jonathan
_______________________________________________
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/HIGH2DVFYDNAWVVXRZNYQ2UEYFVNI3XE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to