On Sat, 14 Sep 2019 at 16:26, George Fischhof <[email protected]> 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? > > It doesn't appear to be any simpler. You just moved async from one place to another. Therefore, change just for change sake, is pointless. In fact, more harm than pointless. -1 > > > BR, > > __george__ > > > _______________________________________________ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/SRWW6U3N3SHNJFLMTX3A4ZRFQGUNKQR6/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Gustavo J. A. M. Carneiro Gambit Research "The universe is always one step beyond logic." -- Frank Herbert
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/CJLL6OYTRQX5B5HX5LBGJ4JTTMXVICTA/ Code of Conduct: http://python.org/psf/codeofconduct/
