[Python-ideas] Anonymous blocks (again):

Nick Coghlan ncoghlan at gmail.com
Sun May 12 16:39:05 CEST 2013


On Sun, May 12, 2013 at 9:56 PM, Juancarlo Añez <apalala at gmail.com> wrote:
> But the context-manager design is shortsighted, and it will exit on the
> first exception it sees, no matter what.

That's not shortsighted, it was a deliberate design decision to
*prevent* with statements from being used as a replacement for
explicit while and for loops. See PEP 343.

> I've tried everything, so I'm pretty sure that there's no clean solution in
> 2.7/3.3.

Correct. This is why PEP 403 exists.

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list