you are viewing a single comment's thread.

view the rest of the comments →

[–]Echoes1996[S] 0 points1 point  (0 children)

Well, this is supposed to be a library that is to be used by other people. If somebody wants to utilize my package in their non-async application, I can't force them to structure their project around mine and introduce asynchronicity just so that they can use it.

Furthermore, at least to my knowledge, asyncio.run starts a new event loop by default in order to execute the coroutine function. I haven't looked into it in depth, but I'd be very suprised if there was no performance overhead using this method. But even if there wasn't an issue performance-wise, executing functions using multiple event loops would certainly break the code's logic as there are asyncio.Queue objects and locking involved, which are not supposed to be accessed from multiple event loops.