python try-finally

后端 未结 1 1492
余生分开走
余生分开走 2020-12-18 18:20

Why does the exception in foo whizz by unnoticed, but the exception in bar is raised?

def foo():
    try:
        raise Exception(\         


        
相关标签:
1条回答
  • 2020-12-18 18:45

    From the Python documentation:

    If the finally clause raises another exception or executes a return or break statement, the saved exception is lost.

    0 讨论(0)
提交回复
热议问题