On Thu, Oct 6, 2016 at 12:45 AM, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote: > Nathaniel Smith wrote: >> >> It wasn't that we created these keywords to solve some >> implementation problem and then inflicted them on users. > > > I disagree -- looking at the history of how we > ended up with async/await, it looks to me like > this is exactly what *did* happen. > > First we had generators. Then 'yield from' was > invented to (among other things) leverage them as > a way of getting lightweight threads. Then 'await' > was introduced as a nicer way to spell 'yield from' > when using it for that purpose. > > Saying that 'await' is good for you because it > makes the suspension points visible seems to me > a rationalisation after the fact. It was something > that emerged from the implementation, not a > prior design requirement.
I wasn't trying to write a detailed account of the development, as much as try to capture some essential features. Myth, not history :-). In the final design, the one and only thing that distinguishes async/await from gevent is that in the former the suspension points are visible, and in the latter they aren't. I don't really believe that it's an accident that people put a lot of effort into creating async/await in this way at a time when gevent already existed and was widely used in production, and we have historical documents like Glyph's blog arguing for visible yield points as a motivation for async/await, but... even if you think it *was* an accident, it hardly matters at this point. The core distinguishing feature between async/await and gevent is the visibility of suspension points, so it might as well be the case that async/await is designed for exactly those people who want visible suspension points. (And I didn't say await or visible suspension points are necessarily "good for you" -- obviously the implicit and explicit interleaving approaches have trade-offs you'll have to judge for yourself. But there are some people in some situations who want implicit interleaving and async/await is there for them.) -n -- Nathaniel J. Smith -- https://vorpus.org _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/