← Back to team overview

launchpad-dev team mailing list archive

Re: The with statement

 

Aaron Bentley wrote:
> Jeroen Vermeulen wrote:
>> Aaron Bentley wrote:
> 
>>> ISTM that try/finally is just syntactic sugar for try/except+raise/else,
>>> and that context managers handle the latter just fine.
>> But to my taste not very transparently, is my point.
> 
> On the other hand, context managers can make the right way to do it also
> the lazy way to do it.

FWIW, I am at least slightly responsible for the with statement getting
in to Python 2.5, and this point was the main reason I thought it was a
good idea: it gave a way to make the lazy way of doing things and the
right way of doing them more like each other.

Cheers,
mwh



References