
On Sat, 30 May 2009 06:58:55 am Gerald Britton wrote:
I guess I'm wondering if we need a with...except construct so that we can get exceptions that happen after the with context is entered without wrapping the with statement in try...except.
On Fri, May 29, 2009 at 5:30 PM, Steven D'Aprano <steve@pearwood.info> wrote:
Would this hypothetical construct:
with some_context_manager() as obj: do_something_with(obj) except Exception: error_handler()
catch exceptions in the context manager, the do_something_with() block, or both? Give reasons for why you make that choice.
-1. As Steven hints, this will just cause more bugs because people won't guess the right semantics for corner cases, and corner cases are all what except clauses are about. -- --Guido van Rossum (home page: http://www.python.org/~guido/)