[Python-ideas] Make return inside a finally a SyntaxError

Michael fuzzyman at gmail.com
Sat Jul 18 01:41:10 CEST 2009


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


Michael Foord

--
http://www.ironpythoninaction.com



More information about the Python-ideas mailing list