On Tue, Mar 01, 2022 at 04:04:31PM +0000, Rob Cliffe via Python-ideas wrote:
> I have use cases for "do exactly once". > Basically a sequence of actions which can be broken off (when something > goes wrong and the whole process should be aborted, or when something > succeeds and there is no need to try alternatives) at various points > with `break`. class MyBreak(Exception): pass 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 -- 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/NHEKCV2MDRDKDVVGABCKSD2L4XSD7Y2W/ Code of Conduct: http://python.org/psf/codeofconduct/