PEP 492, new coroutine syntax for Python

Chris Angelico rosuav at gmail.com
Sat Apr 18 08:20:38 CEST 2015


On Sat, Apr 18, 2015 at 3:32 PM, Paul Rubin <no.email at nospam.invalid> wrote:
> Chris Angelico <rosuav at gmail.com> writes:
>> Hah. It only just hit python-ideas, so you're jumping in on something
>> brand new - no wonder it hasn't been mentioned yet :)
>
> Interesting.  It's dated a couple weeks ago and has obviously been in
> the works for a while.  There's a working implementation which I'd think
> means it's outside the idea phase.

I'm not sure, but I suspect it's been developed/discussed in a SIG.
Today's the first day I've seen stuff about it.

>> I think the current proposal has a lot of duplication (it looks like
>> there's almost a complete replica of the generator protocol being
>> created in parallel), but whatever happens, it's a good thing.
>
> But it's so much cleaner than the existing generator stuff and can
> pretty much replace it.  That is the kind of change that Python 3 really
> should have been about.

Generators have other uses, but I think the intention is to subsume
all the generator-based coroutine system. You'd have to raise this on
-ideas, though.

>> There's a chance this will land in Python 3.5, but if not, I'd be very
>> surprised if it doesn't hit 3.6.
>
> Neat :).  This paper about Lua coroutines is good and if it hasn't been
> part of the PEP discussion and looks relevant, you might want to post it
> there:
>
> http://www.jucs.org/jucs_10_7/coroutines_in_lua/de_Moura_A_L.pdf

I hate to say TLDR, but it's the truth here. I'm posting from theatre
(we're performing The Merry Widow and I'm checking in between follow
spot cues... yeah, I'm insane), and don't have time this week to
evaluate a paper like that on a subject that I'm not an expert on.
Either someone else who subscribes to both python-list and
python-ideas will post it, or you'll have to join -ideas yourself,
sorry.

ChrisA



More information about the Python-list mailing list