[Python-ideas] The async API of the future: yield-from

Calvin Spealman ironfroggy at gmail.com
Wed Oct 17 00:33:55 CEST 2012


On Tue, Oct 16, 2012 at 4:48 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Calvin Spealman wrote:
>
>> I think "yield from" is the obvious way to "call" between tasks, but that
>> there are other cases when we want to spawn a task to begin without
>> blocking our task, and that "yield" should be used here.
>
>
> I've thought of another problem with this. In my scheduler at
> least, simply spawning a task doesn't immediately allow that
> task, or any other, to run. Using "yield" to spell this operation
> gives the impression that it could be a suspension point, when
> it's actually not.

While i still like the feeling, I must concede this point. I could see
them being yielded and forgotten... assuming they would suspend.
Dang.

> It also forces anything that uses it to be called with "yield
> from", all the way up, so if you're relying on the presence of
> yield-froms to warn you of potential suspension points, you'll
> get false positives.
>
>
> --
> Greg
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas



-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy



More information about the Python-ideas mailing list