<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 25, 2017 at 10:06 AM, Phil Mayers <span dir="ltr"><<a href="mailto:p.mayers@imperial.ac.uk" target="_blank">p.mayers@imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"><br></span>
Related, see:<br>
<br>
<a href="http://stackoverflow.com/questions/32139885/yield-in-list-comprehensions-and-generator-expressions" rel="noreferrer" target="_blank">http://stackoverflow.com/quest<wbr>ions/32139885/yield-in-list-<wbr>comprehensions-and-generator-<wbr>expressions</a><br>
<br>
<a href="http://bugs.python.org/issue10544" rel="noreferrer" target="_blank">http://bugs.python.org/issue10<wbr>544</a><br>
<br>
Basically, don't use yield inside comprehensions if you don't want weirdness, AFAICT :o/<br>
<br></blockquote><div><br></div><div>Yes, that's the exact issue!</div><div>Pointed out to me on the python-dev list:</div><div><br></div><div><a href="https://mail.python.org/pipermail/python-dev/2017-January/147242.html">https://mail.python.org/pipermail/python-dev/2017-January/147242.html</a><br></div><div><br></div><div>My vote is that this is a bug in Python.</div><div><br></div><div>--</div><div>Craig</div></div></div></div>