This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaraco
Recipients jaraco, rhettinger
Date 2017-11-28.19:58:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1511899139.94.0.213398074469.issue32158@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-11-28 19:58:59jaracosetrecipients: + jaraco, rhettinger
2017-11-28 19:58:59jaracosetmessageid: <1511899139.94.0.213398074469.issue32158@psf.upfronthosting.co.za>
2017-11-28 19:58:59jaracolinkissue32158 messages
2017-11-28 19:58:59jaracocreate