<div>I can live with `cocall fut()` but the difference between `data = yield from loop.sock_recv(sock, 1024)` and `data = cocall (loop.sock_recv(sock, 1024))()` frustrates me very much.</div>
<div class="mailbox_signature">
<br>—<br>Sent from <a href="https://www.dropbox.com/mailbox">Mailbox</a>
</div>
<br><br><div class="gmail_quote"><p>On Thu, Apr 23, 2015 at 4:09 PM, Victor Stinner <span dir="ltr"><<a href="mailto:victor.stinner@gmail.com" target="_blank">victor.stinner@gmail.com</a>></span> wrote:<br></p><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><p>(I prefer to start a new thread, the previous one is too long for me :-))
<br><br>Hi,
<br><br>I'm still trying to understand how the PEP 3152 would impact asyncio.
<br>Guido suggests to replace "yield from fut" with "cocall fut()" (add
<br>parenthesis) and so add a __cocall__() method to asyncio.Future.
<br>Problem: PEP 3152 says "A cofunction (...) does not contain any yield
<br>or yield from expressions". Currently, Future.__iter__() is
<br>implemented using yield:
<br><br>    def __iter__(self):
<br>        if not self.done():
<br>            self._blocking = True
<br>            yield self  # This tells Task to wait for completion.
<br>        assert self.done(), "yield from wasn't used with future"
<br>        return self.result()  # May raise too.
<br><br>From my understanding, the PEP 3151 simply does not support
<br>asyncio.Future. Am I right?
<br><br>How is it possible to suspend a cofunction if it's not possible to use yield?
<br><br>If waiting for a future in a cofunction is not supported, the PEP 3151
<br>is useless for asyncio, since asyncio completly relies on futures.
<br><br>Victor
<br>_______________________________________________
<br>Python-Dev mailing list
<br>Python-Dev@python.org
<br>https://mail.python.org/mailman/listinfo/python-dev
<br>Unsubscribe: https://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com
<br></p></blockquote></div><br>