Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么没有foo注意到whiz中的异常,但bar引发了异常?
foo
bar
def foo(): try: raise Exception('foo') finally: return def bar(): try: raise Exception('bar') finally: pass foo() bar()
从Python 文档:
如果 finally 子句引发另一个异常或执行 return 或 break 语句,则保存的异常将丢失。