[Python-Dev] async/await in Python; v2 (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 23 01:47:29 CEST 2015
- Previous message (by thread): [Python-Dev] async/await in Python; v2
- Next message (by thread): [Python-Dev] async/await in Python; v2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Yury Selivanov wrote:
On the other hand, I hate the idea of grammatically requiring parentheses for 'await' expressions. That feels non-pytonic to me.
How is it any different from grammatically requiring parens in an ordinary function call? Nobody ever complained about that.
In the PEP 3152 way of thinking, a cocall is just a function call that happens to be suspendable. The fact that there is an iterator object involved behind the scenes is an implementation detail. You don't have to think about it or even know about it in order to write or understand suspendable code.
It's possible to think about "yield from f(x)" or "await f(x)" that way, but only by exploiting a kind of pun in the code, where you think of f(x) as doing all the work and the rest as a syntactic marker indicating that the call is suspendable. PEP 3152 removes the pun by making this the actual interpretation of "cocall f(x)".
-- Greg
- Previous message (by thread): [Python-Dev] async/await in Python; v2
- Next message (by thread): [Python-Dev] async/await in Python; v2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]