PEP 765:禁止在finally块中使用return/break/continue语句
原文英文,约800词,阅读约需3分钟。发表于: 。This PEP proposes to withdraw support for return, break and continue statements that break out of a finally block. This was proposed in the past by PEP 601. The current PEP is based on empirical...
PEP 765提议禁止在finally块中使用return、break和continue语句,以避免异常吞噬和混淆。该提案基于对现有代码的分析,显示这些用法罕见且易出错。计划在Python 3.14中发出SyntaxWarning,未来可能升级为SyntaxError,以提高代码安全性和可读性。