On 6 October 2016 at 17:45, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
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'd say it emerged from most folks still not grasping generators-as-coroutines a decade after PEP 342, and asynchronous IO in general ~15 years after Twisted was first released. When a language usage pattern is supported for that long, but folks still don't grok how it might benefit them, you have a UX problem, and one of the ways to address it is to take the existing pattern and give it dedicated syntax, which is exactly what PEP 492 did. Dedicated syntax at least dramatically lowers the barrier to *recognition* of the coroutine design pattern when it's being used, and can help with explaining it as well (since the overlap with other concepts in the language becomes a hidden implementation detail rather than being an essential part of the user experience). The shadow thread idea will hopefully prove successful in addressing the last major rough spot in the UX, which is the ability to easily integrate asynchronous components into an otherwise synchronous application. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia