Re: [python] using try: finally: except
From: Tim Peters (tim.peters_at_gmail.com)
Date: 06/25/04
- Next message: Mark: "Re: Python Magazine exists! (was: Python intro questions)"
- Previous message: Mahrt, Dallas: "RE: [python] using try: finally: except"
- In reply to: Peter Hansen: "Re: [python] using try: finally: except"
- Next in thread: Antoon Pardon: "Re: [python] using try: finally: except"
- Reply: Antoon Pardon: "Re: [python] using try: finally: except"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Jun 2004 14:08:19 -0400 To: python-list@python.org
[Tim Peters]
>> 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.
[Peter Hansen]
> 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?
If present, a 'finally' clause had to be the last clause in a
try/except/finally structure. That was enforced by the syntax. The
most common confusion was over whether the code in the 'finally'
clause would execute if an exception was raised during execution of an
'except' clause. That code isn't in the 'try' block, so why should
'finally' apply to it? For that matter, why shouldn't it? That's why
nobody could remember (and I in fact don't remember what happened
then).
- Next message: Mark: "Re: Python Magazine exists! (was: Python intro questions)"
- Previous message: Mahrt, Dallas: "RE: [python] using try: finally: except"
- In reply to: Peter Hansen: "Re: [python] using try: finally: except"
- Next in thread: Antoon Pardon: "Re: [python] using try: finally: except"
- Reply: Antoon Pardon: "Re: [python] using try: finally: except"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|