经典代码(同样适用于Java、JavaScript):

def lol():
    try:
        return True
    finally:
        return False

调用lol()后,究竟是返回False还是True呢?相信你和我一样,最开始认为是True,因为try中的语句先执行,对吧?

但事实上:

>>> lol()
False

try had a try. Finally, finally won.

所以,不要在异常语句中用return……