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

Janzert janzert at janzert.com
Sun Oct 13 01:44:05 CEST 2013


On 10/12/2013 6:27 PM, Raymond Hettinger wrote:
>
> On Oct 12, 2013, at 1:41 PM, Ethan Furman <ethan at stoneleaf.us
> <mailto:ethan at stoneleaf.us>> wrote:
>
>> .  break_on reads just fine to me, although leave_on is probably better.
>
> Sorry, these are both really bad.
>
> I've user tested ignore() and had good results.
> It makes the intention of the code very clear.
>

I'm curious what your users think this will do

print("start listing")
with ignore(ZeroDivisionError):
     for i in range(0, 4):
         inv = 1 / i
         print("1 over {} is {}".format(i, inv))
print("finished")

I think there's a decent chance I'd get it wrong if I was scanning 
through code with that construct in the midst of it.

Janzert



More information about the Python-Dev mailing list