Created
March 10, 2025 14:05
-
-
Save bmitc/31398a6a06c74ce8a9c45cb9ea3cbd3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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