>
> > 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.
>

Which all other stuff? Are you saying that you wouldn't need to use "async
def", if there was an "async yield" in the function?

But that doesn't solve many problems, because you can create async
functions that don't have a yield in them -- ie, they are async, but not
generator functions, the two are orthogonal.

-CHB

-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
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/UZDBBCZVYPHRL3XEPNTOH43XSQRC5KGN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to