This is a continuation of my previous post to this thread.

Python's FOR ... ELSE ... , Raymond Hettinger has told us, has origins in some ideas of Don Knuth. For that reason, and others, I'll concisely review these ideas.

In the very early days, a computer program was a sequence of commands. The goto <somewhere> command was used to create loops, and the IF command was used to break from loops. Often, this led to what was called spaghetti code. (In some versions of BASIC, the GOTO was to a line number.)

In the 1960's ideas developed to remedy this situation.  Edsger Dijkstra coined the phrase 'structured programming', and he was the author of the famous paper 'Go To Statement Considered Harmful'. (I recall reading that the title was supplied by Wirth.)

Aside: This is in the context of source code. By 1970 there were higher level languages, which were compiled into machine code. Dijstraka I'm sure approved, within limits, of GOTO in machine code. One consequence of structured programming is to provide and guarantee such limits.

Don Knuth's 1974 paper, Structured Programming with goto statements, finds merit in both sides of the question. One of his goals is "improved syntax for iterations and error exits, making it possible to write a larger class of programs clearly and efficiently without goto statements".

Nearly done with the review. Knuth finds a result of Lipton, Eisenstadt and DeMillo especially noteworthy. Briefly, for every large n, there is an n-statement program using goto statements that cannot be 'nicely converted' to a structured program. 

By 'nicely converted' (my phrase) Knuth means that the structured program is either larger or slower or both than the goto program, with a numeric lower bound on by how much. (Size exponential in n, speed logarithmic in n, both with explicit constants.)

This justifies Knuth's phrase "a larger class of programs" in the goal I just stated.

Aside: Incidentally, Knuth's paper uses coroutines in his discussion of efficient implementation of Hoare's quicksort algorithm. In it he credits Strachey sharing with Knuth the importance of coroutines (or goto) for producing a conceptually simple solution to the problem of merging two binary trees. It might help if a tutorial on how to do this in Python, by using async and wait, was written.

My next post will apply some of the concepts in Knuth's goto paper to FOR ... ELSE ... in Python.

The above relies on a lot of implied knowledge. If you don't already have it, the above might be hard going. I hope it helps at least some of you.
-- 
Jonathan