2024-04-24 22:01:18 发布
网友
尽管Python(从3.5版起)支持两种编写协同程序的方法,但它的“一种方法”理念是众所周知的:
假设我们只需要支持Python>;=3.5版本。是否有必要使用旧的、基于生成器的协同程序?或者基于async/await的协程完全取代了基于生成器的协程?在
async
await
引用Guido van Rossum himself:
[...] eventually we'll always be using async functions when coroutines are called for, dedicating generators once again to their pre-PEP-342 role of a particularly efficient way to implement iterators.
引用Guido van Rossum himself:
相关问题 更多 >
编程相关推荐