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

Ethan Furman ethan at stoneleaf.us
Sat Oct 12 06:05:20 CEST 2013


On 10/11/2013 07:47 PM, Stephen J. Turnbull wrote:

Nick Coghlan writes:

> (RDM is also right that the exception still has the effect of > terminating the block early, but I view names as mnemonics rather > than necessarily 100% accurate descriptions of things). This is just way too ambiguous for my taste. I can't help reading

[snippers]

How about

with contextlib.breakon(ExceptionIDontFeelLikeHandlingProperly): stmt1 stmt2 stmt3 This is not 100% accurate Pythonically (there's no loop to break here), but it does describe what the context manager does more accurately, and it does effectively break out of the 'with' control structure.

+1 (if we have to have it)

While I agree that mnemonics are helpful in the right circumstances, these aren't them, not for this name. We aren't /just/ ignoring the exception, the exception is having a very real effect -- it's terminating the with block.

-- Ethan



More information about the Python-Dev mailing list