Live data from Hacker News

A conceptual overview of asyncio

github.com

31–32 of 32 posts

Re: A conceptual overview of asyncio

#31
post #26

asyncio by itself doesn't support asynchronous file I/O, see their wiki: https://github.com/python/asyncio/wiki/ThirdParty#filesystem You have to use something like aiofiles to do that.

Mhm. You need another thread to accomplish async file reads, which is basically what aiofiles does. This isn't really to the fault of asyncio. The necessary OS primitive isn't available. See the Linux documentation for the O_NONBLOCK flag and note this part: "Note that this flag has no effect for regular files" [1]. I actually originally wrote the sockets example in this article as using file i/o until I came across…

Yep. Even io_uring sends all block device commands to a backend thread pool.

I think only benefit is reduced syscall overhead.

Re: A conceptual overview of asyncio

#32

Why would anyone want to use asyncio over trio. The latter is one of the few structured concurrency systems that doesn't make me want to pry my eyeballs out with a spoon.

Use anyio to get compatibility with both and lots of async related tools like object steams.
Post reply on HN