Am 30.11.16 um 22:07 schrieb Gregory Ewing:
Chris Angelico wrote:

That's because you're not actually running anything concurrently.

Yes, I know what happens and why. My point is that for
someone who *doesn't* know, simplistic attempts to
explain what "await" means can be very misleading.

There doesn't seem to be any accurate way of summarising
it in a few words. The best we can do seems to be to
just say "it's a magic word that you have to put in
front of any call to a function that you defined as
async".

well that works - but I think it it is possible to explain it, without actually understanding what it does behind the scences:

x = foo()
# schedule foo for execution, i.e. put it on a TODO list

await x
# run the TODO list until foo has finished

IMHO coroutines are a simple concept in itself, just that stackful programming (call/return) has tainted our minds so much that we have trouble figuring out a "function call" which does not "return" in the usual sense. The implementation is even more convoluted with the futures and promises and whatnot. For simply using that stuff it is not important to know how it works.


        Christian
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to