Message362965
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. |
|
Date |
User |
Action |
Args |
2020-02-29 06:46:36 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, terry.reedy, ncoghlan, benjamin.peterson, ethan.furman |
2020-02-29 06:46:36 | serhiy.storchaka | set | messageid: <1582958796.3.0.212573522827.issue39725@roundup.psfhosted.org> |
2020-02-29 06:46:36 | serhiy.storchaka | link | issue39725 messages |
2020-02-29 06:46:36 | serhiy.storchaka | create | |
|