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

Chris Angelico rosuav at gmail.com
Fri Sep 9 05:28:27 EDT 2016


On Fri, Sep 9, 2016 at 7:23 PM, Lawrence D’Oliveiro
<lawrencedo99 at gmail.com> wrote:
> 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.

FWIW I think it's great that they have similar coding styles. We don't
have a problem with threading and multiprocessing having very similar
APIs, do we? Yet they exist to solve distinctly different problems.

ChrisA



More information about the Python-list mailing list