I honestly can't read those examples and be surprised. Do I have finally-colored glasses? Maybe "What does f do? It returns 3, but then in finally returns 4" reads understandably, if silly, to me. I will admit that a finally with a non-conditional return or raise will effectively be a blank except: but in that case, as well, I say "well, don't do that" On Fri, Jul 17, 2009 at 7:41 PM, Michael<fuzzyman@gmail.com> 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
Michael Foord
-- http://www.ironpythoninaction.com _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy