PEP 492: isn't the "await" redundant?

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Fri Sep 9 05:23:51 EDT 2016


On Friday, August 26, 2016 at 10:08:25 PM UTC+12, Marko Rauhamaa wrote:
> Ultimately, asyncio and multithreading might well merge. It will be
> difficult for a programmer to decide in the beginning of the design
> which way to go as the programming models are almost identical.

The two will never merge, because asyncio is non-preemptive, while threading is preemptive. Threading is for compute performance (and this is no good in pure Python unless you write a C extension module), at the cost of much trickier programming and greater propensity to bugs, while asyncio lets you interleave background processing with waits for time-consuming external activities (I/O, including network I/O, or just waiting for the user to click a button or press a key), while keeping the race conditions manageable.

So you see, they have very different application areas, that only superficially overlap.



More information about the Python-list mailing list