[Python-ideas] Async API

Yury Selivanov yselivanov.ml at gmail.com
Sat Oct 27 07:07:07 CEST 2012


On 2012-10-27, at 12:54 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> The idea of asynchronous programming is to
> only use additional threads when you really need them (i.e. for
> blocking synchronous operations with no asynchronous equivalent)

BTW, you've touched a very interesting subject.  There are lots of
potentially blocking operations that are very hard to do asynchronously
without threads.  Such as working with directories or even reading
from files (there is aio on linux, but I haven't seen a library
that supports it.)

It would be great if we can address those problems with the new
async API.  I.e. we can use threadpools where necessary, but make 
the public API look fancy and yield-from-able.  Same approach that 
Joyent uses in their libuv.  And when OSes gain more advanced and
wide non-blocking support we can decrease use of threads.


More information about the Python-ideas mailing list