18 Jul
2009
18 Jul
'09
2:31 a.m.
Michael schrieb:
Here are two examples of why allowing return inside a finally block is a bad idea:
def f(): try: return 3 finally: return 4
def f(): try: raise Exception() finally: return 4
Woot! That's totally. It never even occurred to me to use return in the finally block. +1 for the syntax error. Nice catch, Michael! Christian PS: I wasn't sure so I tested the functions. Both functions return 4.