Op 2017-09-10, Marko Rauhamaa schreef <ma...@pacujo.net>: > Stephan Houben <stephan...@gmail.com.invalid>: > >> Would we not eventually want a file object to deliver its lines >> asynchronously (with non-blocking reads under the hood) if >> iterated over with "async for", while preserving the current >> blocking behavior in the "for" case? > > I'm not exactly sure what your point is.
I mean that I would imagine that 1. functionality as is today available in `aiofiles' would at some point be integrated into the standard library, and 2. that this might be done in such a way that there is no distinction anymore between a normal file object and an "aiofiles" file object, unlike today. > As for file objects supporting asynchronous iterators, I agree they > should. OK, that is essentially my point 2, above. > Linux is not quite ready for nonblocking file access yet (the > kernel developers are busy trying to make it happen). > > Note that you will not only need an async version of a file iterator but > also versions for the "open()" function, directory walking etc. open() already supports non-blocking mode (as does read() and write(), of course). readdir() is indeed currently always blocking. Stephan -- https://mail.python.org/mailman/listinfo/python-list