Re: [Python-Dev] 'continue'/'break'/'return' inside 'finally' clause

2018年1月04日 17:27:44 -0800

We should interview you for the paper we may be writing for HOPL.
On Wed, Jan 3, 2018 at 6:05 PM, Neil Schemenauer <[email protected]>
wrote:
> On 2018年01月03日, Guido van Rossum wrote:
> > I'm sorry, I don't think more research can convince me either way.
> > I want all three of return/break/continue to work inside finally
> > clauses, despite there being few use cases.
>
> That's fine. The history of 'continue' inside 'finally' is
> interesting. The restriction dates back to at least when Jeremy
> committed the AST-based compiler (I have fond memories of hacking on
> it with Armin Rigo and others at a Python core sprint). Going
> further back, I looked at 1.5.2 and there is the comment in
> compile.c:
>
> TO DO:
> ...
> XXX Allow 'continue' inside try-finally
>
> So if we allow 'continue' we will be knocking off a nearly 20 year
> old todo item. ;-)
>
> For giggles, I unpacked a Python 0.9.1 tarball. The source code is
> all under 'src' in that version. There doesn't seem to be a
> restriction on 'continue' but only because the grammar doesn't
> include it! Without doing more research, I think the restriction
> could be as old as the 'continue' keyword.
>
> BTW, the bytecode structure for try/except shown in the compile.c
> comments is very simlar to what is currently generated. It is quite
> remarkable how well your initial design and implementation have stood
> the test of time. Thank you for making it open source.
>
> Regards,
>
> Neil
>
-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to