coroutines



examples/async/co_routine.py
import asyncio

async def answer():
    print("start to answer")
    return 42

async def main():
    a_coroutine = answer()
    print(a_coroutine)

    await asyncio.sleep(0)
    print('before await for coroutine')

    result = await a_coroutine
    print(f"result is {result} after await")
 
asyncio.run(main())

<coroutine object answer at 0x7f8d06e6d240>
before await for coroutine
start to answer
result is 42 after await