On Mon, Sep 16, 2019 at 7:13 PM George Fischhof <geo...@fischhof.hu> wrote: > > yes exactly I would like this. > > Regarding the waiting and frameworks: > > The solution should be independent from waiting and frameworks: > > Let's see what happens now (sync, not async) > > User has a generator, he wants values. > > Uses a for cycle to process all values from generator: > Asks for first value - wait for the value to be computed > Processes the value he got > Asks for next value - wait for the value to be computed > And processes again, and again > > The async version: > > User has a generator, he wants values, he created an async version, because > he wants the values faster >
Okay, well that's the problem. An async function won't yield the values faster, and it will not allow two things to happen simultaneously. It just allows I/O and other such operations to happen asynchronously. If you want the values faster, consider instead a second thread or process and a queue; in place of the generator, just read from the queue, which will block until you have something to read. Meanwhile, your other thread/process is generating values and placing them on the queue. What you're asking for is not just a syntactic change - it's a significant semantic change that introduces concurrency in ways that async functions do not currently have. Basically you'd get all the problems of threading, without the advantages of threading. ChrisA _______________________________________________ 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/LXAXTHPHYMUIKJIFVK4PN4OLB7LQGKZX/ Code of Conduct: http://python.org/psf/codeofconduct/