[Python-Dev] 'continue'/'break'/'return' inside 'finally' clause (original) (raw)

Guido van Rossum gvanrossum at gmail.com
Thu Dec 28 15:30:19 EST 2017


I don't think the language definition should be judgmental here. The semantics are unambiguous.

On Dec 28, 2017 11:38 AM, "Serhiy Storchaka" <storchaka at gmail.com> wrote:

28.12.17 16:38, Guido van Rossum пише:

Looks to me the prohibition was to prevent a crash. It makes more sense to fix it.

The crash can be fixed by just removing the check after finishing issue17611. But is there any use case for 'continue'/'break'/'return' inside 'finally' clause? The code like try: return 1 finally: return 2 or try: continue finally: break looks at least confusing. Currently 'break' and 'return' are never used inside 'finally' clause in the stdlib. I would want to see a third-party code that uses them.


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido% 40python.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20171228/0953c562/attachment.html>



More information about the Python-Dev mailing list