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 ncoghlan
Recipients ncoghlan, rhettinger
Date 2013-10-15.11:50:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Issue 15806 added contextlib.ignored to the standard library (later renamed to contextlib.ignore), as a simple helper that allows code like:

    except FileNotFoundError:

to instead be written as:

    with ignore(FileNotFoundError):

The point has been made that "ignore" may easily be taken to mean preventing the exception being raised *at all* (since truly ignoring the exception would mean not skipping the rest of the with statement), rather than suppressing the exception in the context manager's __exit__ method.

If you look at the rest of the contextlib docs, as well as the docs for the with statement and context manager objects, they don't refer to returning True from __exit__ as ignoring the exception, but rather as *suppressing* it. Even the docs for contextlib.ignore now make use of the term "suppress".

So I think it makes sense to rename the context manager to "suppress", while keeping the same semantics:

    with suppress(FileNotFoundError):
Date User Action Args
2013-10-15 11:50:54ncoghlansetrecipients: + ncoghlan, rhettinger
2013-10-15 11:50:54ncoghlansetmessageid: <>
2013-10-15 11:50:54ncoghlanlinkissue19266 messages
2013-10-15 11:50:54ncoghlancreate