[Python-Dev] more pyref: continue in finally statements
Michael Urman
murman at gmail.com
Wed May 3 05:49:33 CEST 2006
On 5/1/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> then what should be the meaning of "continue" here? The finally
> block *eventually* needs to re-raise the exception. When should
> that happen?
It should behave similarly to return and swallow the exception. In
your example this would result in an infinite loop. Alternately the
behavior of return should be changed, and the below code would no
longer work as it does today.
>>> def foo():
... try: raise Exception
... finally: return 'Done'
...
>>> foo()
'Done'
Michael
--
Michael Urman http://www.tortall.net/mu/blog
More information about the Python-Dev
mailing list