PEP 765: Disallow return/break/continue that exit a finally block

Ironically, linters play a part in making syntax warnings hard to filter (they don’t like it when code precedes import lines, and syntax warnings are often emitted at import time, so suppressing them involves manipulating the warnings filter before the main module imports anything else).

I genuinely don’t understand the rationale behind seeing “this is a syntax error for everyone” as a better end state than “this is a syntax warning for users that don’t precompile their code, which turns into an error if the warning system is configured that way”.

The warning should be enough to discourage the construct in new code, while being buried in dependency installation logs for many end users (uv is popular and rapidly growing, but still not the most common installation tool).

That said, I’d prefer deprecation and escalating to a full error over dropping the warning, so if anyone did write a follow up PEP for full removal, I wouldn’t argue too hard against it (just request that it reference and address the reasons PEP 601 failed in proposing that and PEP 765 refrained from proposing it).

4 Likes