[Python-ideas] Async API: some more code to review

Yury Selivanov yselivanov.ml at gmail.com
Tue Oct 30 03:29:59 CET 2012


On 2012-10-29, at 9:40 PM, Steve Dower <Steve.Dower at microsoft.com> wrote:

> To save people scrolling to get to the interesting parts, I'll lead with the links:
>  
> Detailed write-up: https://bitbucket.org/stevedower/tulip/wiki/Proposal
>  
> Source code: https://bitbucket.org/stevedower/tulip/src

Your design looks very similar to the framework I developed.
I'll try to review your code in detail tomorrow.

Couple of things I like already:

1) Use of 'yield from' is completely optional

2) @async decorator.  That makes coroutines more visible and
allows to add extra methods to them.

3) Tight control over coroutines execution, something that
is completely missing when you use yield-from.

I dislike the choice of name for 'async', though.  Since 
@async-decorated functions are going to be yielded most of the 
time (yield makes them "sync" in that context), I'd stick to 
plain @coroutine.

P.S. If this approach is viable (optional yield-from, required
@async-or-something decorator), I can invest some time and
open source the core of my framework (one benefit is that it
has lots and lots of unit-tests).

-
Yury


More information about the Python-ideas mailing list