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

Victor Stinner victor.stinner at gmail.com
Thu Apr 23 22:29:26 CEST 2015


Hi,

2015-04-23 17:54 GMT+02:00 Yury Selivanov <yselivanov.ml at gmail.com>:
> Greg wants to implement __cocall__ on futures.  This way
> you'll be able to write
>
>    cocall fut()  # instead of "await fut"

Oh, I missed something in the PEP 3152: a obj__cocall__() method can
be an iterator/generator, it can be something different than a
cofunction. So a __cocall__() *can* use yield and yield from. But to
use cocall, it must be a cofunction.

It's not easy to understand the whole puzzle. IMO the PEP 492 better
explains how pieces are put together ;-)

Victor


More information about the Python-Dev mailing list