[Python-ideas] A Continuations Compromise in Python

John Graham john.a.graham at gmail.com
Sun May 3 18:31:13 CEST 2009


Back to the bike shed argument, the use of 'continue' is incidental.
I personally like it, but I totally can see the arguments brought
against it.  My main thrust is for explicit TCO in Python, to allow
for different models of computation in an explicit, Pythonic way.  I
believe others have suggested making 'yield from' require tail calls,
or introducing 'yield as'.  Both have their ups and downs.  I'd
suggest we debate whether or not the original idea, a TCO keyword in
python, separate from what that keyword ought to be.  It's no use
talking about keywords if the original idea is bunk, and I believe the
second argument can be won far more pragmatically than the first,
which requires some careful thought on all of our parts.

On Sun, May 3, 2009 at 11:06 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Mon, 4 May 2009 02:00:25 am John Graham wrote:
>> I want to clarify that the original suggestion was never to implement
>> TCO 'implicitly'.  I don't want to have to 'write my function just
>> right' to get TCO to work.  This is why the keyword was suggested, as
>> it'd be an explicit way to tell the interpreter 'this is a
>> tail-call'. If it's not, then throw an exception.  Otherwise, there's
>> no optimizations going on behind the scenes that I'm not aware of,
>> which is the case in languages that just turn tail calls optimized
>> behind the scenes.
>
> Hmmm... that puts a whole new light on your proposal, at least in my
> mind. I'm still dubious about using the keyword continue, but less so
> than before. Let me think about it.
>
> --
> Steven D'Aprano
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



More information about the Python-ideas mailing list