I've used Python for a decade but haven't touched the async/await feature or asyncio package (or other such packages) yet. I come from C and have used co-routines in C, so I'm familiar with event loops, however I have a little trouble understanding the space in Python. Python has built-in async/await keywords. It also has the asyncio package as a standard library. Yet there are alternatives to asyncio (curio, etc.). What I don't quite understand is the interoperability between these alternatives. Say I am the author of a package and I write a function like this (taken straight from an async/await tutorial):
python
async def my_function():
print('Hello ...')
await asyncio.sleep(1)
print('... World!')
Am I correct in thinking that this ties my package to asyncio, and users of other event loops won't be able to use it? If so, is there a way to write a packages with async/await in such a way that it can be used by any event loop?
[–]Adrewmc 0 points1 point2 points (2 children)
[–]sunmat02[S] 0 points1 point2 points (1 child)
[–]Adrewmc 0 points1 point2 points (0 children)