[python] using try: finally: except

Tim Peters tim.peters at gmail.com
Tue Jun 22 21:45:49 EDT 2004


[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.




More information about the Python-list mailing list