Is this pythonic?
Marko Rauhamaa
marko at pacujo.net
Thu Nov 24 03:39:45 EST 2016
"Frank Millman" <frank at chagford.com>:
> "Steven D'Aprano" wrote in message
> news:58368358$0$1513$c3e8da3$5496439d at news.astraweb.com...
>> I'm a newbie to asyncio, but if I were doing this using threads, [...]
>
> To me, the beauty of asyncio (or I suppose async in general) is that I
> don't have to worry about any of what you describe above.
The programming model for threads and asyncio coroutines is identical.
The differences for the programmer are smallish details:
* In asyncio, all functions that can potentially block must be tagged
with "async" and all calls to such functions must be tagged with
"await".
* Not all blocking functions have an equivalent coroutine. All
functions are readily available to threads.
* Coroutines can be killed, threads cannot.
* Coroutines can be multiplexed, threads cannot.
Marko
More information about the Python-list
mailing list