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

It was definitely intentional. I re-confirmed that in my response to PEP 601, where I pointed out a legitimate use case (after which the very first SC voted 4/4 to reject that PEP).

Also note that it was (eventually) implemented correctly. To me, that’s another clue it wasn’t an accident.

For me, the only two solutions that make sense are:

A) Revert the syntax warning and rely on PEP 8 and linters instead.

B) Deprecate it and plan to remove it in 2-5 releases. This could be a simple follow-up PEP.

If there are problems with when the warning is issued (making it impossible to filter) I’m sure there are creative solutions for that that can help make the transition easier (and can be introduced in 3.14.1).

4 Likes