Nick Coghlan added the comment: contextlib.suppress provides a contextmanager spelling for the following pattern:
try: <body> except <expr>: pass That's a very common pattern worth having in the standard library, even though it's only a 5 line context manager. The proposed API change would make it instead an implementation of the vastly *less* common pattern: try: <body> except <unless-expr>: raise except <expr>: pass For the use case you're discussing (trying to shut down, potentially failing, but also not wanting to hide genuine programming errors), I'd be more amenable to introducing a comparable context manager to the logging module that, instead of silently ignoring caught exceptions, logged them, and also allowed you to restrict which exceptions were logged. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27814> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com