Re: [Async-sig] Additive merging of async generators
![](https://secure.gravatar.com/avatar/5c222946aec6c3eba59a7d35ec36ad66.jpg?s=120&d=mm&r=g)
20 Jul
2018
20 Jul
'18
12:24 a.m.
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.
2198
Age (days ago)
2198
Last active (days ago)
0 comments
1 participants
participants (1)
-
twisteroid ambassador