On Oct 15, 2013, at 11:52 AM, R. David Murray wrote:

>I think 'trap' would be much clearer.  What about making the context
>manager provide the trapped exception, in a fashion similar to
>what assertRaises does?  Even if that was almost never used in practice,
>the fact that the CM provides only *one* exception no matter how
>many statements are in the with block would strongly reinforce the
>actual semantics of the construct.  It would also make it parallel to
>assertRaises, which seems like a consistency bonus.
>
>And I could see it getting used.  I think I've had code where the logic
>was: possibly trap an exception, stuff it in a variable, do some logic,
>check the variable to see if we had an exception earlier, and if so do
>something with it or otherwise branch the logic.  I won't say this is
>common, and I won't say there wouldn't often be a better way to write
>it...but I can think that it might have utility.
>
>With that change, I'd be +1.  With just suppress, I'm -0.

Yeah, I would also be +1 with that.

-Barry
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to