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 the
>        generator writer.  Against this was brought in that the
>        generator *appears* to suppress an exception that it cannot
>        suppress: the transactional() example would be more clear
>        according to this view if it re-raised the original exception
>        after the call to db.rollback().  [...]

Of course, the explicit re-raise is only needed in a minority of use 
cases where the exception is caught. Two additional points in favour of 
this:

- refactoring a naked try as a with + template is more direct and 
uniform across all use cases.

- it is upwards compatible if the prohibition on templates suppressing 
exceptions is ever reconsidered. (Flow control macro discussion not 
withstanding.)

- Arnold

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to