官术网_书友最值得收藏!

Introduction to AsyncIO

AsyncIO is the official asynchronous framework for Python. As explained in the previous section, this does not mean that it is the only one available. Twisted and Gevent are two other asynchronous frameworks that are very famous. However, since its release in Python 3.4, AsyncIO has become very popular rather quickly. There is no doubt that one reason for this success comes from the philosophy of Python: There should be only one obvious way to do something. Since AsyncIO is part of the standard library, it is the de facto  way to do asynchronous programming in Python. Another reason is probably that it was released with the correct timing, when developers regained interest in asynchronous programming.

AsyncIO relies on three entities:

  • Futures: They represent values that will be available later
  • Coroutines: They allow you to execute asynchronous actions
  • Event loops: They schedule the execution of the active tasks

These three entities are the classical ones in modern asynchronous programming. Let's look at each of them.

主站蜘蛛池模板: 连山| 长兴县| 乐都县| 东海县| 五河县| 乡宁县| 隆林| 得荣县| 望城县| 九江市| 出国| 重庆市| 凤凰县| 穆棱市| 乡城县| 宁陕县| 九江县| 本溪| 蒙城县| 台前县| 彭阳县| 五河县| 德钦县| 互助| 德化县| 兴宁市| 台南市| 长岭县| 铜山县| 夏津县| 天镇县| 左云县| 东乌| 山西省| 和平区| 额敏县| 碌曲县| 安岳县| 封开县| 安义县| 曲水县|