Jason R. Coombs <jar...@jaraco.com> added the comment:

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.

----------
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32158>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to