<div dir="ltr">On 22 November 2017 at 15:47, Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com" target="_blank">p.f.moore@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I generally don't understand "await" in any context, so I deferred<br>
judgement on that :-) Based on your comment that they are equally<br>
tricky, I'd suggest we prohibit them both ;-)<br>
<br>
Less facetiously, comprehensions are defined in the language reference<br>
in terms of a source translation to nested loops. That description<br>
isn't 100% precise, but nevertheless, if yield/async in a<br>
comprehension doesn't behave like that, I'd consider it a bug. So<br>
current behaviour (for both yield and await) is a bug, and your<br>
proposed semantics for yield is correct.<br></blockquote><div><br></div><div>I think there may be a small misunderstanding here. The situation is different for comprehensions and generator expressions,</div><div>let me summarize the current state:</div><div><br></div><div>- yield in comprehensions works "wrong" (a shorthand for not according to the docs/naive expectations, i.e. not equivalent to for loop)</div><div>- await in comprehensions works "right"</div><div>- yield in generator expressions works "wrong"</div><div>- await in generator expressions works "wrong"</div><div><br></div><div>After some thinking, both `yield` and `await` look quite mind bending in _generator expressions_, so maybe the right compromise strategy is:</div><div><br></div><div>- fix yield in comprehensions</div><div>- await in comprehensions already works</div><div>- make both `yield` and `await` a SyntaxError in generator expressions.</div><div><br></div><div>What do you think?</div><div><br></div><div>--</div><div>Ivan</div><div><br></div><div><br></div></div></div></div>