try: finally: question

Peter Hansen peter at engcorp.com
Tue Jul 6 18:44:26 EDT 2004


djw wrote:

> OK, yeah, I think you are correct. What wasn't apparent to me is that a
> finally: doesn't stop the exception from continuing to propagate. I just
> wish you could intermix except: and finally: within the same try: block.

You used to be able to do that, according to a recent thread on the
subject.  It was removed because it was ambiguous what would happen.
For example, if an exception were raised in a finally clause which
came just before the except clause, would the except clause catch it?
Since the finally is technically outside of the try block, some
people thought it shouldn't be caught by the following except.
Others did.  Guido nuked it.

Anyway, it would be purely syntactic sugar for what we have now,
saving you a few keystrokes and one extra level of indentation.
No big deal.

-Peter



More information about the Python-list mailing list