【发布时间】:2020-11-20 18:43:09
【问题描述】:
考虑 Python 文档中的 this example:
def gen(): # defines a generator function
yield 123
async def agen(): # defines an asynchronous generator function
yield 123
我知道这个例子很简单,但是我可以用gen做什么而不能用agen做些什么,反之亦然?我会以什么方式注意到它们的不同?
相关:
我认为这个问题会有所帮助,但我仍然不明白: What are the differences between the purposes of generator functions and asynchronous generator functions
【问题讨论】:
标签: python python-3.x async-await generator