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-le...@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/SRWW6U3N3SHNJFLMTX3A4ZRFQGUNKQR6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to