Serhiy Storchaka <[email protected]> added the comment:
Because there may be more exceptions than the code writer know. The code raised
OverflowError and ValueError may be in different function, so the code writer
know only about ValueError, but OverflowError is an implementation detail (and
may be absent in other versions).
Currently the code writer has to write the cumbersome code
was_raised = False
try:
foo() # may raise ValueError -> OverflowError
except:
was_raised = True
if was_raised:
raise KeyError from None
if they want to suppress only exceptions raised in foo(). And it is worse in
case of finally.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39725>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com