A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-April/139480.html below:

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

[Python-Dev] PEP 3152 and yield from Future() [Python-Dev] PEP 3152 and yield from Future()Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 24 02:49:05 CEST 2015
Victor Stinner wrote:

> You didn't answer to my question. My question is: is it possible to
> implement Future.__cocall__() since yield is defined in cofunctions.
> If it's possible, can you please show how? (Show me the code!)

The implementation of a __cocall__ method is *not* a
cofunction, it's an *ordinary* function that returns
an iterator. In the case of Future, what it needs to
do is identical to Future.__iter__. So the code can
be just

     def __cocall__(self):
         return iter(self)

or equivalent.

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4