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

PJ Eby pje at telecommunity.com
Tue Oct 15 18:28:30 CEST 2013


On Tue, Oct 15, 2013 at 11:52 AM, R. David Murray <rdmurray at bitdance.com> wrote:

I think 'trap' would be much clearer.

+1. Short and sweet, and just ambiguous enough that you don't leap to the conclusion that the error is ignored. I agree that "suppress" is basically a synonym for "ignore"; trap at least implies some kind of control flow change, which is what's needed to prevent misconceptions.

Personally, I would rate "catch" higher than "trap" because it further implies that it is catching a thrown exception, but would compromise to "trap" if that'll end the thread sooner. ;-)

What about making the context manager provide the trapped exception, in a fashion similar to what assertRaises does?

Sadly, that won't work, since context managers provide a value before the block is executed, not after.



More information about the Python-Dev mailing list