"Almost free" is not free.On Tue, Mar 1, 2022 at 2:23 PM Steven D'Aprano <steve@pearwood.info> wrote:
try:
do_this()
if condition: raise MyBreak
do_that()
if condition: raise MyBreak
do_next_step()
if condition: raise MyBreak
do_last_step()
except MyBreak:
pass
Why not:
while True:[loop body with ordinary breaks]break
It's less to write and almost free of charge*, and it also supports redo (continue).