Coroutines and asyncio
See Typing async/await for the full detail on typing coroutines and asynchronous code.
- import asyncio
- # A coroutine is typed like a normal function
- async def countdown35(tag: str, count: int) -> str:
- while count > 0:
- print('T-minus {} ({})'.format(count, tag))
- await asyncio.sleep(0.1)
- count -= 1
- return "Blastoff!"