> 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