<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<div>
<div style="font-family:Calibri,sans-serif; font-size:11pt">The high-level answer to this is, like yield, the function temporarily returns all the way up the stack to the caller who intends to advance the iterator/async function. This is typically the event
 loop, and the main confusion here comes when the loop is implicit.<br>
<br>
If you explicitly define an event loop it's roughly equivalent to the for loop that is calling next on a generator. For pip, I expect that's what you'd have - a blocking function ("do_work()"?, "execute_plan()"?) that creates a loop and starts it's tasks running
 within it. Each task inside that call with be asynchronous with respect to each other (think about passing generators to zip() ) but the loop will block the rest of your code until they're all finished.<br>
<br>
Cheers,<br>
Steve<br>
<br>
Top-posted from my Windows Phone</div>
</div>
<div dir="ltr">
<hr>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">From:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:p.f.moore@gmail.com">Paul Moore</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Sent:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt">ý4/ý30/ý2015 2:07</span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">To:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:greg.ewing@canterbury.ac.nz">Greg Ewing</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Cc:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:python-dev@python.org">Python Dev</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Subject:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt">Re: [Python-Dev] PEP 492 quibble and request</span><br>
<br>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On 30 April 2015 at 09:58, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:<br>
> Ethan Furman wrote:<br>
>><br>
>> Having gone through the PEP again, I am still no closer to understanding<br>
>> what happens here:<br>
>><br>
>>   data = await reader.read(8192)<br>
>><br>
>> What does the flow of control look like at the interpreter level?<br>
><br>
><br>
> Are you sure you *really* want to know? For the sake<br>
> of sanity, I recommend ignoring the actual control<br>
> flow and pretending that it's just like<br>
><br>
>    data = reader.read(8192)<br>
><br>
> with the reader.read() method somehow able to be<br>
> magically suspended.<br>
<br>
Well, if I don't know, I get confused as to where I invoke the event<br>
loop, how my non-async code runs alongside this etc.<br>
Paul<br>
_______________________________________________<br>
Python-Dev mailing list<br>
Python-Dev@python.org<br>
<a href="https://mail.python.org/mailman/listinfo/python-dev">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/steve.dower%40microsoft.com">
https://mail.python.org/mailman/options/python-dev/steve.dower%40microsoft.com</a><br>
</div>
</span></font>
</body>
</html>