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

IronPython Tools for Visual Studio CTP3

Further Adventures of the Debugger