Can I suggest that for loops the `else` would be a lot clearer if it was spelt `finally` as was done for PEP-0341 for try blocks and that we might possibly need one or more `on_…` clauses such as `on_break` and `on_finish` I think that this would be a lot clearer:

 

for i in range(N):

    if i > 3:

        break;

on_break:  # Called if loop was broken

    print(i)

on_finish:  # Called if loop was not broken

    print("Loop Completed")

finally:  # Always called (replaces for…else)

    print("Loop Ended")

 

Which I think would be a lot easier for newcomers to learn than try…for…else…except…else e.g.:

 

try:

    for i in range(N):

       if i > 3:

            break;

       elif i % 2 == 0:

            raise ValueError("Odds Only");

        else: # to if

            print(i)

    else:  # Else to loop

        print("Loop Completed")

except ValueError as err:

    print(err)

else:  # to try

    print("No Exception")

finally:

    print("Try Ended")

 

Where the multitude of elses makes my eyes cross.

 

Steve Barnes