[Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().

Victor Stinner victor.stinner at gmail.com
Fri Oct 11 11:43:31 CEST 2013


[We are discussing issue #15806.]

2013/10/11 Antoine Pitrou <solipsis at pitrou.net>:
> I don't think that this contextlib.ignore() thing has been discussed a
> lot.

If we decide to keep the feature, I would prefer a less generic name:
contextlib.ignore_excep(), contextlib.ignore_exception() or
contextlib.ignore_exceptions().

> Ezio was -1 on the tracker, and Eric Smith was -0. I'd like to add my
> -1 too. This is a useless addition (the traditional idiom is perfectly
> obvious) and makes reading foreign code more tedious by adding
> superfluous API calls.
>
> Please consider reverting.  There is absolutely zero use case for this
> that wasn't already solved by the traditional "except ...: pass" idiom.

The purpose of the new context manager is to reduce the number of line
of code? It goes a little bit against a Zen Principle:

    There should be one-- and preferably only one --obvious way to do it.

Victor


More information about the Python-Dev mailing list