[python] using try: finally: except

Peter Hansen peter at engcorp.com
Tue Jun 22 22:07:03 EDT 2004


Tim Peters wrote:

> [Peter Hansen, on mixing 'except' with 'finally' clauses]
> 
>>I recall differently.  I recall reading several times that since
>>it is completely ambiguous what the programmer meant if both are
>>specified together, Guido deliberately kept them separate so that
>>one had to be very explicit about whether the finally was inside
>>or outside the except.
> 
> 
> It's more that Guido deliberately separated them.  Before Python
> 0.9.6, you could attach both 'except' and 'finally' clauses to the
> same 'try' structure (see Misc/HISTORY in a Python source
> distribution).  I don't remember the semantics, and that was indeed
> the problem:  nobody could remember, and half the time guessed wrong.

I'm curious: was it that the order of execution was fixed, regardless
of the order of the 'finally' and 'except' in the source, or was
it still confusing even though the order of execution changed
logically with the order of the statements in the source?



More information about the Python-list mailing list