asyncx.wait_any

async asyncx.wait_any(*awaitables)[source]

Creates a coroutine that waits for any of given awaitables to be completed.

Example

>>> coro1 = asyncio.create_task(asyncio.sleep(1))
>>> coro2 = asyncio.create_task(asyncio.sleep(2))
>>> await asyncx.wait_any(coro1, coro2) is coro1
True
Parameters

awaitables (Awaitable[Any]) – Awaitable objects to wait.

Returns

A Coroutine object that returns first finished asyncio.Future object.

Return type

Awaitable[Any]