Hey Yeray, thanks for the response in such short time.
Let me clear up my question — I am working on a codebase, which uses twisted, but is migrating to asyncio. As for starters, the maintainers want to support twisted , but support async/await syntax. So I have been using twisted’s inbuilt function — asFuture
and fromFuture
, which helps me wrap the user written coroutines and convert them to deferreds and futures as and when required. The main problem lies, when I want to wrap an asychronous generator into a future, so that I can use fromFuture
to get deferreds, and make my life easy. But as asyncio does not support converting async gen objects into future, so I am sort of stuck out here.
A workaround I found was that asynchronous generator object, when asynchronous_obj.asend()
method is called, it returns a coroutine object(https://www.python.org/dev/peps/pep-0525/#implementation-details), so I thought I could use that. That is where, I want to iterate through each of the coroutine object that the asend
method returns into a list, and then wrap them into a future.
I know that it is a complex problem, but few insights to it would be quite valuable.
Thanks and regards,
Yash