Asyncio -- delayed calculation

Marko Rauhamaa marko at pacujo.net
Wed Nov 30 17:15:24 EST 2016


Terry Reedy <tjreedy at udel.edu>:

> On 11/30/2016 7:53 AM, Chris Angelico wrote:
>
>> I also think that everyone should spend some time writing
>> multithreaded code before switching to asyncio. It'll give you a
>> better appreciation for what's going on.
>
> I so disagree with this. I have written almost no thread code but have
> successfully written asyncio and async await code. Perhaps this is
> because I have written tkinter code, including scheduling code with
> root.after. The tk and asyncio event loops and scheduling are quite
> similar.

I kinda agree with Chris in that asyncio is a programming model
virtually identical with multithreading. Asyncio is sitting on an
event-driven machinery, but asyncio does its best to hide that fact.

The key similarity between coroutines and threads is concurrent linear
sequences of execution that encode states as blocking function calls.


Marko



More information about the Python-list mailing list