
July 18, 2009
2:18 a.m.
Michael wrote:
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
I wouldn't call that a syntax error. Wouldn't you also have to forbid break, continue and, perhaps, yield? Isn't Python for consenting adults, or something like that? :-)