Goroutines in Python with go(...)
What is go(...)?
go(...)?from pychanio import go
go(coro, *args, **kwargs)Example:
import asyncio
from pychanio import go
async def worker(name):
for i in range(3):
await asyncio.sleep(0.5)
print(f"{name} working {i}")
async def main():
go(worker, "A")
go(worker, "B")
await asyncio.sleep(2)
asyncio.run(main())Advantages of go(...)
go(...)Use With Channels
What’s Next?
Last updated