Message307158
Fair enough.
For an example, here's the case where I wanted to use the decorator to avoid excess indentation and keep the most meaningful part of the function at the base of the body:
@suppress(KeyError)
def v12_to_13(manager, case):
case['sample_id'] = case.pop('caseid')
In my opinion, it's nominally nicer and clearer than:
def v12_to_13(manager, case):
with suppress(KeyError):
case['sample_id'] = case.pop('caseid')
But I see your points about encouraging overly-broad catching of exceptions... so it's better to have the indentation as something of a wart to dissuade excess wrapping. |
|
Date |
User |
Action |
Args |
2017-11-28 19:58:59 | jaraco | set | recipients:
+ jaraco, rhettinger |
2017-11-28 19:58:59 | jaraco | set | messageid: <1511899139.94.0.213398074469.issue32158@psf.upfronthosting.co.za> |
2017-11-28 19:58:59 | jaraco | link | issue32158 messages |
2017-11-28 19:58:59 | jaraco | create | |
|