A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20171122/22f0978f/attachment.html below:

<div dir="ltr"><div>Serhiy,<br><br></div>I think this is indeed a problem. For me the biggest surprise was that `yield` inside a comprehension does not turn a surrounding function into comprehension, see also<br><div><div><a href="https://stackoverflow.com/questions/29334054/why-am-i-getting-different-results-when-using-a-list-comprehension-with-coroutin">https://stackoverflow.com/questions/29334054/why-am-i-getting-different-results-when-using-a-list-comprehension-with-coroutin</a></div><div><br></div><div>In fact there is a b.p.o. issue for this <a href="https://bugs.python.org/issue10544">https://bugs.python.org/issue10544</a>, it is assigned to me since July, but I was focused on other things recently.</div><div>My plan was to restore the Python 2 semantics while still avoiding the leak of comprehension variable to the enclosing scope (the initial reason of introducing auxiliary "_make_list" function IIUC).</div><div>So that:</div><div><br></div><div>1) g = [(yield i) for i in range(3)] outside a function will be a SyntaxError (yield outside a function)</div><div>2) g = [(yield i) for i in range(3)] inside a function will turn that enclosing function into generator.</div><div>3) accessing i after g = [(yield i) for i in range(3)] will give a NameError: name 'i' is not defined<br></div><div><br></div><div>If you have time to work on this, then I will be glad if you take care of this issue, you can re-assign it.<br></div><div><br></div><div>--</div><div>Ivan</div><div><br></div><div><br></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