I'm trying understand if asyncio is a necessary part of the Python definition of coroutines or simply a convenience package.
Can I run this program without asyncio?
import time
async def clk():
time.sleep(0.1)
async def process():
for _ in range(2):
await clk();
time.sleep(0.2)
print("I am DONE waiting!")
def run():
await process()
if __name__ == "__main__":
run()
I get the error that run() is not defined with async, which I get, but there seems to be an infinite regress to the top. Interestingly, this code runs (without the run() function) in Jupyter notebook. I just type await process.
asyncio.run). Jupyter conveniently hides this from you, but it still executes it with the help of asyncio: ipython.readthedocs.io/en/stable/interactive/…