Asynchronous programming

Paul Rudin paul.nospam at rudin.co.uk
Thu Aug 11 12:47:43 EDT 2016


Steven D'Aprano <steve+python at pearwood.info> writes:

>
> But what's the point in doing it asynchronously if I have to just wait for
> it to complete?
>
>   begin downloading in an async thread
>   twiddle thumbs, doing nothing
>   process download

If you have nothing else to do, then there's no point.

But suppose you're implementing a web server. A request comes in - in
order to respond you need some data from a database. So you do the
database bit async. Whilst you're waiting for that you can get on with
processing other incoming requests.





More information about the Python-list mailing list