Generator-based coroutine versus native coroutine

前端 未结 3 1998
挽巷
挽巷 2021-01-04 22:31

I just read PEP0492 talking about the new approach on coroutines but the PEP failed to make me understand the difference between generator-based coroutines and native ones.

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-04 22:48

    There is no functional difference. "Native coroutines" using the async and await keywords are just syntactic sugar for what was previously implemented in "generator-based coroutines."

    The use of async and await is recommended in the 3.5 docs if there is no need to support older Python versions.

提交回复
热议问题