
I don't get it. You show one example then another unrelated example? That doesn't make anything clear to me at least.
On 14 Sep 2019, at 17:24, George Fischhof <george@fischhof.hu> wrote:
Hi All,
While I was reading the documentation of asyn generators, which shows the following example:
async def ticker(delay, to): """Yield numbers from 0 to *to* every *delay* seconds.""" for i in range(to): yield i await asyncio.sleep(delay)
It's came to my mind that it could could be simpler.
We could use just async yield and all the other stuff could be done in the background.
Like if we use the yield in function, that function becomes a generator
example:
def my_async_generator(): for i in range(5): async yield i
What do you think about this? Would this be feasible?
BR, __george__
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/SRWW6U... Code of Conduct: http://python.org/psf/codeofconduct/