[Async-sig] A possible tiny step towards event loop interoperability

Nathaniel Smith njs at pobox.com
Fri Jun 3 21:14:28 EDT 2016


On Fri, Jun 3, 2016 at 6:10 PM, Ben Darnell <ben at bendarnell.com> wrote:
> The introduction of `await` has imposed similar restrictions on both
> systems, so there is no more yielding of lists or dicts in either case;
> explicit wrapper objects must be used. (but there's still a difference in
> that asyncio.Task allows None but tornado coroutines do not)

I'm not saying that yielding lists or dicts is useful, but it sounds
like you're saying that somehow it's actually incompatible with
async/await, and I don't understand why that would be -- e.g., this
works fine?:

In [2]: @types.coroutine
   ...: def yield_list():
   ...:     yield [1, 2, 3]
   ...:

In [3]: async def f():
   ...:     await yield_list()
   ...:

In [4]: next(f().__await__())
Out[4]: [1, 2, 3]

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Async-sig mailing list