Answer the question
In order to leave comments, you need to log in
What is the difference in designs?
import asyncio
import time
async def say_after(delay, what):
await asyncio.sleep(delay)
print(what)
async def main():
print(f"started at {time.strftime('%X')}")
await say_after(1, 'hello')
await say_after(2, 'world')
print(f"finished at {time.strftime('%X')}")
asyncio.run(main())
import time
def say_after(delay, what):
time.sleep(delay)
print(what)
def main():
print(f"started at {time.strftime('%X')}")
say_after(1, 'hello')
say_after(2, 'world')
print(f"finished at {time.strftime('%X')}")
main()
Answer the question
In order to leave comments, you need to log in
I don’t know what you have in Sea Sharp, but here is an excerpt from the official Sea Sharp documentation :
The await operator suspends evaluation of the enclosing async method until the asynchronous operation represented by its operand completes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question