<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 27, 2018 at 11:43 AM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 03/27/2018 11:12 AM, Ivan Levkivskyi wrote:<span class=""><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 27 March 2018 at 18:19, Guido van Rossum wrote:<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hm, so maybe we shouldn't touch lambda, but we can at least fix the scope issues for comprehensions and genexprs.<br>
</blockquote>
<br>
Removing the implicit function scope in comprehensions is something I wanted for long time.<br>
It would not only "fix" the scoping, but will also fix the yield inside comprehensions.<br>
</blockquote>
<br></span>
Can we do it without leaking names?<br></blockquote></div><br></div><div class="gmail_extra">Assuming you're concerned about leaking names out of the comprehension into the class scope, that shouldn't be a problem. (The solution actually involves leaking names *into* the comprehension scope, but I'm not sure that should be called "leaking". :-)<br><br></div><div class="gmail_extra">I do notice that we probably can't easily solve this using the existing closure machinery ("cells") because if we were to have cells in the class dict, it would confuse everything else that looks in the class namespace.<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>