<div dir="auto"><div><div class="gmail_quote"><div dir="ltr"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Skip, I think you have misunderstood the point I was making. It was <br>
not whether the loop variable should leak out of a list comprehension. <br>
Rather, it was whether a local variable should, so to speak, "leak into" <br>
a list comprehension. And the answer is: it depends on whether the code <br>
is executed normally, or via exec/eval. <br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Got it. Yes, you'll have to pass in locals to exec. (Can't verify, as I'm on the train, on my phone.) Builtins like range are global to everything, so no problem there.</div><div dir="auto"><br></div><div dir="auto">Your clarification also make it more of a Python programming question , I think.</div><div dir="auto"><br></div><div dir="auto">Skip</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>