A simple introduction to Python’s asyncio

Python asyncio

An article by Apoorv Garg on hackernoon.com gives a simple introduction to Python’s asyncio.

He writes:

Why do we want to write asynchronous programs you say — because it could increase the performance of your program many many times. Imagine you have a single core machine you are running your app on. You receive a request, and you need to make two database queries to fulfil that request. Each query takes 50ms of time. With a synchronous program, you would make the second request only after completing the first — total time 100ms. With an asynchronous program, you could fire off both the queries one after the other — total time 50ms.

asyncio

Asyncio is all about writing asynchronous programs in Python. Asyncio is a beautiful symphony between an Event loopTasks and Coroutines all coming together so perfectly — it’s going to make you cry.

You can read the full article here.

code + comm



from Adafruit Industries – Makers, hackers, artists, designers and engineers! https://ift.tt/2M2WBBA
via IFTTT