[Python-Dev] PEP 3152 and yield from Future()

Yury Selivanov yselivanov.ml at gmail.com
Thu Apr 23 17:54:06 CEST 2015


Hi Victor,

On 2015-04-23 4:43 AM, Victor Stinner wrote:
[...]
>  From my understanding, the PEP 3151 simply does not support
> asyncio.Future. Am I right?
>

Greg wants to implement __cocall__ on futures.  This way
you'll be able to write

    cocall fut()  # instead of "await fut"

So you *will have to* use "()"


Another problem is functions that return future:

def do_something():
     ...
     return fut

With Greg's idea to call it you would do:

    cocall (do_something())()

That means that you can't refactor your "do_something"
function and make it a coroutine.

Yury


More information about the Python-Dev mailing list