【发布时间】:2010-08-02 17:43:51
【问题描述】:
我今天在博客中发现了这个有趣的项目:
def abc():
try:
return True
finally:
return False
print "abc() is", abc()
谁能说出它为什么会这样做?
谢谢, 韩国
【问题讨论】:
-
虽然不完全一样,但可以在这里找到一个很好的讨论:stackoverflow.com/questions/1611561/…
-
-1:甚至没有尝试在docs.python.org/reference/compound_stmts.html#the-try-statement中查找finally语句