Yash Sharma
1 min readJul 3, 2018

--

Hey Yeray, thanks for the articles, they are quite helpful.
I was working on a pet project, in which I had been using asynchronous generators. I wanted to use them in asyncio, but to no avail. In PEP 525, they are iterated through another coroutine —

async def async_gen():

yield 1

await asyncio.sleep(1)

yield 2

await asyncio.sleep(1)

Now the above can be utilised using a coroutine and async iteration:

async def coro():

async for obj in async_gen():

pass

What I wanted is to iterate through the asynchronous generator explicitly, and utilise them in asyncio. It would kind of you if you can look into this problem. Thanks.

--

--

Yash Sharma
Yash Sharma

Written by Yash Sharma

Open Source Enthusiast | IITian

Responses (1)