<div dir="ltr">On Sat, Oct 4, 2008 at 10:18 AM, Terry Reedy <span dir="ltr"><<a href="mailto:tjreedy@udel.edu">tjreedy@udel.edu</a>></span> wrote:<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Greg Ewing wrote:<br>
tement, which will be familiar to nobody.<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
It's true that with a 'let' statement or equivalent,<br>
there's no strict need for a change to the for-loop,<br>
since you can always say<br>
<br>
for i in range(10):<br>
let i = i:<br>
funcs.append(lambda: i)<br>
<br>
But it's an annoying and odd-looking piece of<br>
boilerplate to have to use, and in that respect is<br>
similar to the existing solutions of inserting another<br>
lambda or using a default argument value.<br>
<br>
So as a *convenience*, I'm suggesting that the<br>
for-loop be given automatic let-like behaviour.<br>
</blockquote>
<br></div>
Whereas I consider the proposed automaticity to be a grave inconvenience and confusion factor. What if I *want* a closure to be over variables, as normal, instead of values.</blockquote><div><br>Why would you want that for a loop variable ? Can you give an example where this would be the desired behavior ?<br>
<br>George<br><br> <br></div></div><br></div>