Skip to main content

Treat multiple async iterators as a single async iterator.

Project description

Windmolen

Treat multiple asynchronous iterators like they are a single asynchronous iterator.

Example:

import asyncio
from windmolen import FanIn


async def async_iterator_1():
    for i in range(1, 5):
        yield i
        await asyncio.sleep(0.5)


async def async_iterator_2():
    for j in range(5, 9):
        yield j
        await asyncio.sleep(1)


async def main():
    async with FanIn(async_iterator_1(), async_iterator_2()) as async_iterators:
        async for item in async_iterators:
            print(item)


if __name__ == "__main__":
    asyncio.run(main())

Install

pip install windmolen

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

windmolen-0.0.1.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

windmolen-0.0.1-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page