[Python-ideas] with-except-finally blocks

Ethan Furman ethan at stoneleaf.us
Thu Apr 16 23:46:49 CEST 2015


On 04/17, Steven D'Aprano wrote:
> On Thu, Apr 16, 2015 at 08:35:14AM -0700, Ethan Furman wrote:
>> Steven D'Aprano wrote:
>>> 
>>> No more than any other block of code. There is nothing special about 
>>> with blocks that go with exception handling [...]
>> 
>> I have to disagree:  'with' blocks are exactly a condensed try/finally, with the
>> added capability of being able to suppress exceptions -- this makes them very
>> special with respect to exception handling.
> 
> Yes, yes, that's a given that with statements encapsulate a finally 
> clause. But that is missing the point.

No, that's entirely the point.  You claimed:

>>>  There is nothing special about with blocks that go with exception handling

when in fact exception handling (even if just ignoring) is half their reason for
existence.

It was an unfortunate choice of words, not a big deal.  Nobody who has called you on it
has suggested the proposal is a win for Python syntax.

--
~Ethan~


More information about the Python-ideas mailing list