Re: [Python-Dev] PEP 343 rewrite complete

2005-06-02 Thread Arnold deVos
Guido van Rossum wrote: > >[...] a generator doing cleanup depending on the >exception thrown (like the transactional() example below) can >*catch* the exception thrown if it wants to and doesn't have to >worry about re-raising it. I find this more convenient for t

Re: [Python-Dev] PEP 343 rewrite complete

2005-06-02 Thread Arnold deVos
Arnold deVos wrote: > > This template eats eats the exception, which will cause a RuntimeError > in the proposed Wrapper, I think. A raise after rollback is needed. Actually, the Wrapper as written in the PEP does not raise RuntimeError if the generator catches a block's excepti

Re: [Python-Dev] PEP 343 rewrite complete

2005-06-02 Thread Arnold deVos
Guido van Rossum wrote: > [Phillip J. Eby] >>* The transaction handler could also be written as: >> >> @with_template >> def transactional(db): >> db.begin() >> try: >> yield db >> except: >> db.rollback() >> else: >> db.co

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-15 Thread Arnold deVos
Guido van Rossum wrote: > [...] But some of the claims from PEP 3XX seem to be incorrect now: Nick > claims that a with-statement can abstract an except clause, but that's > not the case; [...] Sorry for being a lurker, but can I try and expand this point. The options: - If we don't allow the ex