Skip to content

Instantly share code, notes, and snippets.

@bmitc
Created March 10, 2025 14:05
Show Gist options
  • Save bmitc/31398a6a06c74ce8a9c45cb9ea3cbd3f to your computer and use it in GitHub Desktop.
Save bmitc/31398a6a06c74ce8a9c45cb9ea3cbd3f to your computer and use it in GitHub Desktop.
import asyncio
import time
from typing import Any, Callable, Coroutine
async def uses_a_callback(callback: Callable[[int], Coroutine[Any, Any, None]]) -> None:
t = time.monotonic_ns()
await callback(t)
async def main() -> None:
async def callback(t: int):
print(f"Callback called with {t}")
await uses_a_callback(callback)
if __name__ == "__main__":
asyncio.run(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment