It is suggested to employ if/else, the new pattern matching feature, or functional decomposition rather than nesting exceptions.
https://discuss.python.org/t/add-way-to-reenter-previous-try-block/4526/2 

Pattern matching will look syntactically cleaner.

Exceptions are slow (only when an exception is caught) compared to conditionals and/or pattern matching.

But sometimes catching exceptions is the only way; and in those cases I think it's easier to read them nested; just like nested conditionals.

A contrived bad code example:

try:
   f()
except TypeError:
   log.info("isinatance conditionals are faster")
except ConnectionError try:
   retry()
except KeyboardInterrupt as e try:
   log.info("Ctrl C caught")
   flush()
except Exception as e:
    log.exception(e)



On Mon, Oct 12, 2020, 5:42 AM Mathew Elman <mathew.elman@ocado.com> wrote:
This is quite similar to something I suggested on Python Discussions
https://discuss.python.org/t/add-way-to-reenter-previous-try-block/4526
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/EXWK52CP4P42GJCDX7E6XXDF6V75ZRJO/
Code of Conduct: http://python.org/psf/codeofconduct/