Michael Büsch added the comment: >and instead point you towards https://bugs.python.org/issue12029
Fair enough. But how would a 'suppress OSError, but catch FileNotFoundError' look like with this for example? (Note that I can't subclass the exception) >I'm also not sure it's an idiom we really want to encourage, as it tends to >age poorly as new exception subclasses are added, I partially agree. But there's one important spot where I need this behaviour: It is cleanup paths where I cannot react to most exceptions. For example because I already am handling exceptions and am already trying to tear the whole thing down anyway. >as well as confusing exception flow logic like the example given in the >documentation I disagree. The control flow does not change with this patch at all. It either pops out of the with-statement with an exception, or it does not. The only thing this patch does is _reduce_ the set of exceptions it suppresses. >For folks that do need this capability, building it themselves is pretty >straightforward, Nah. The whole point of contextlib.suppress is to avoid boilerplate code. People could do their own stuff. In fact, that is what I did. But I prefer a standard solution in the standard library for this really common problem instead. ---------- _______________________________________ 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