On further thought, maybe something like this is what you are looking 
for?

https://code.activestate.com/recipes/580808-guard-against-an-exception-in-the-wrong-place/

This allows you to replace one or more kinds of exceptions with another 
specified exception (defaults to RuntimeError) using a context manager.



-- 
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/KZDXAV7K2G7U64PV2WAC4CQTVPNFW6CL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to