Skip to content

Instantly share code, notes, and snippets.

@carljm
Created February 20, 2026 21:44
Show Gist options
  • Select an option

  • Save carljm/b96241cf74dba1f9d25930d4812b8e06 to your computer and use it in GitHub Desktop.

Select an option

Save carljm/b96241cf74dba1f9d25930d4812b8e06 to your computer and use it in GitHub Desktop.
import asyncio
from typing_extensions import reveal_type
async def task() -> tuple[int, str]: ...
async def test() -> None:
futures: set[asyncio.Task[tuple[int, str]]] = {
asyncio.create_task(task()) for _ in range(3)
}
while True:
wait = asyncio.wait(futures, return_when=asyncio.FIRST_COMPLETED)
try:
done, futures = await asyncio.wait_for(wait, 3)
except Exception:
return
reveal_type(wait)
reveal_type(done)
reveal_type(futures)
[rules]
empty-body = "ignore"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment