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

Victor Stinner victor.stinner at gmail.com
Wed Oct 16 14:01:37 CEST 2013


2013/10/16 Antoine Pitrou <solipsis at pitrou.net>:
>> By the way, what are the performances of contextlib.ignore()?
>> Exceptions can be slow in some cases. Adding something even slower
>> would not be a good idea.
>
> A "try" block which succeeds is fast.

Ah yes, I never reminder this fact. I try to not care too much of
micro-optimizations :-)

> A context manager will always be
> slower, especially when written in pure Python with a generator wrapped
> in a contextlib.contextmanager.

ignore() is much slower than try/except even if the block succeeds?

Victor


More information about the Python-Dev mailing list