If I were to implement something like this from scratch, I would write
a class that basically wraps an asyncio.Queue. For each input async
generator to be merged, simply iterate through it and put each element
in the queue, and write an output async generator that gets and yields
elements from the queue. Maintain a counter of source generators that
haven't been exhausted yet, and when that falls to 0, stop the output
generator. Should be pretty straightforward.
_______________________________________________
Async-sig mailing list
Async-sig@python.org
https://mail.python.org/mailman/listinfo/async-sig
Code of Conduct: https://www.python.org/psf/codeofconduct/

Reply via email to