Greg, how waiting for multiple cocalls should look and work?

In asyncio when I need to wait for two and more coroutines/futures I
use `asyncio.gather()`:

yield from gather(coro1(a1, a2), coro2(), fut3)

>From my understanding to use cofunctions I must wrap it with costart call:

yield from gather(costart(coro1, a1, a2), costart(coro2), fut3)

That looks weird.

There are other places in asyncio API those accept coroutines or
futures as parameters, not only Task() and async().

On Thu, Apr 23, 2015 at 12:25 PM, Greg Ewing
<greg.ew...@canterbury.ac.nz> wrote:
> Yury Selivanov wrote:
>>
>> I think that the problem of forgetting 'yield from' is a bit exaggerated.
>> Yes, I myself forgot 'yield from' once or twice. But that's it, it has never
>> happened since.
>
>
> I think it's more likely to happen when you start with
> an ordinary function, then discover that it needs to
> be suspendable, so you need to track down all the
> places that call it, and all the places that call
> those, etc. PEP 3152 ensures that you get clear
> diagnostics if you miss any.
>
> --
> Greg
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com



-- 
Thanks,
Andrew Svetlov
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
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