Return vs. Finally - C# and IronPython

Mike Stall has an interesting new blog entry on the difference between C# and Python regarding returns in finally blocks:
Did you know that returns in finally blocks swallow exceptions in Python? (I didn't):

>>> def f():
... try:
... raise Exception('ouch')
... finally:
... return 3
...
>>> f()
3
>>>

Comments

Popular posts from this blog

Extending Abobe Flash Player and AIR with Python and Ruby

Should Python Projects Support IronPython and Jython?

Further Adventures of the Debugger