Showing content from http://mail.python.org/pipermail/python-dev/attachments/20171125/9fcc68b9/attachment.html below:
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 25 November 2017 at 16:57, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Sat, Nov 25, 2017 at 6:55 AM, Ivan Levkivskyi <span dir="ltr"><<a href="mailto:levkivskyi@gmail.com" target="_blank">levkivskyi@gmail.com</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"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="m_7904138329541714044gmail-">On 25 November 2017 at 04:30, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</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"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="m_7904138329541714044gmail-m_-321702978631925968gmail-">On Fri, Nov 24, 2017 at 4:22 PM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br></span><span class="m_7904138329541714044gmail-m_-321702978631925968gmail-"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">The more I hear about this topic, the more I think that `await`, `yield` and `yield from` should all be banned from occurring in all comprehensions and generator expressions. That's not much different from disallowing `return` or `break`.<span></span><br></div></blockquote></span></div><br clear="all"></div><div class="gmail_extra">From the responses it seems that I tried to simplify things too far. Let's say that `await` in comprehensions is fine, as long as that comprehension is contained in an `async def`. While we *could* save `yield [from]` in comprehensions, I still see it as mostly a source of confusion, and the fact that the presence of `yield [from]` *implicitly* makes the surrounding `def` a generator makes things worse. It just requires too many mental contortions to figure out what it does.</div></div></blockquote><div><br></div></span>[...]<br><div>If the first example will be allowed, then one will be surprised why it can't be rewritten as</div><div><br></div><div><div>Â Â Â def pack_two():</div>Â Â Â Â Â Â Â return [(yield) for _ in range(2)]</div></div></div></div></blockquote></span><span class=""><div><br></div></span><div>And yet Nick's example shows that that is not equivalent!</div><span class=""><div><br></div><div>[...]<br></div><div><br></div></span><div>In this example each thing that looks syntactically like a list comprehension becomes actually a generator expression at at runtime! And so does your example, so instead of a list of two items, it returns a generator that will produce two values when iterated over.</div><div><br></div><div>That's not referential transparency to me, it feels more like a bug in the code generator.</div><div><br></div><div>I want to ban this because apparently nobody besides Nick knows about this behavior (I certainly didn't, and from the above it seems you don't either).<br></div><span class=""></span></div></div></div></blockquote><div><br></div><div>This whole thread started as a proposal to fix this bug and to make the two forms equivalent, so I don't know what you are talking about.</div><div><br></div><div>Also as there appeared arguments of authority (thanks Antoine) its time to stop this discussion for me.<br></div><div><br></div><div>--</div><div>Ivan</div><div><br></div><div><br></div></div></div></div>
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