Go-style generators in asyncio

Hi all,
I've recently been looking into the go concurrency model to see how it compares to asyncio and an interesting concept caught my attention: go generators.
It's quite similar to asynchronous generator, with a bit of extra concurrency.
You can find a small write-up comparing the two concepts [1] and a possible implementation of go-style generators using asyncio [2].
[1]: https://gist.github.com/vxgmichel/4ea46d3ae5c270260471d304a2c8e97b [2]: https://gist.github.com/vxgmichel/8fc63c02389dc6807206dec7ede9eb99
My conclusion is that go-style generators are quite useful in the context of a pipeline of generators producing and processing values asynchronously.
This research was motivated by my work on aiostream [3], an asynchronous version of itertools, that does not benefit from this kind of optimization (yet).
[3]: https://github.com/vxgmichel/aiostream
Hope you'll find this interesting,
Cheers, /Vincent
participants (1)
-
Vincent Michel