[Python-ideas] "try with" syntactic sugar

Guido van Rossum guido at python.org
Fri Feb 27 20:20:14 CET 2009

On Fri, Feb 27, 2009 at 4:49 AM, Curt Hagenlocher <curt at hagenlocher.org> wrote:
> On Fri, Feb 27, 2009 at 2:49 AM, Arnaud Delobelle
> <arnodel at googlemail.com> wrote:
>> Every compound statement could be made into an implicit try, i.e.
> That way lies madness.  What distinguishes "with" from other compound
> statements is that it's already about resource management in the face
> of possible exceptions.

Still, a firm -1 from me. Once we have "try try" I'm sure people are
going to clamor for "try if", "try while", "try for", even (oh horror
:-) "try try". I don't think we should complicate the syntax just to
save one level of indentation occasionally.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-ideas mailing list