Asynchronous programming

Marko Rauhamaa marko at pacujo.net
Sat Aug 13 04:25:50 EDT 2016


Paul Rubin <no.email at nospam.invalid>:

> Keep in mind that the above basically takes the task off the list of
> runnables for 0.2 seconds, so it sits doing nothing and doesn't
> interfere with other tasks running. In the case where you're doing
> actual computation, you want to yield (await) much more often than 0.2
> sec, so other tasks can stay responsive. This is cooperative
> multitasking, where each task has to be nice to the others, in
> contrast with preemptive multitasking where the task switches happen
> behind the scenes.

I don't suppose the Python database API has yet been ported to asyncio,
has it? That means database access is not yet quite usable with asyncio
(or any other form of asynchronous programming).

Also, one must be careful with file access, which is necessarily
blocking on linux (unless Python takes Linux's AIO API into use, which
would be groundbreaking).


Marko



More information about the Python-list mailing list