<div class="gmail_quote">On 25 September 2012 23:09, Ian Kelly <span dir="ltr"><<a href="mailto:ian.g.kelly@gmail.com" target="_blank">ian.g.kelly@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, Sep 25, 2012 at 12:17 PM, Oscar Benjamin<br>
<<a href="mailto:oscar.j.benjamin@gmail.com">oscar.j.benjamin@gmail.com</a>> wrote:<br>
> Also I think lambda functions might be able to keep the frame alive. Are<br>
> they by any chance being created in a function that is called in a loop?<br>
<br>
</div>I'm pretty sure they don't. Closures don't keep a reference to the<br>
calling frame, only to the appropriate cellvars.<br></blockquote><div><br></div><div>OK, that's good to know.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Also note that whether a function is a closure has nothing to do with<br>
whether it was defined by a lambda or a def statement. In fact,<br>
there's no difference between functions created by one vs. the other,<br>
except that one has an interesting __name__ and the other does not.<br>
:-)</blockquote><div><br></div><div>That's true but in my experience most lambda functions are defined inside another function, whereas most ordinary functions are not. Also when creating a closure with an ordinary function it's very clear what you are doing (which is why I don't use lambda functions for this) so I think it's a little easier to accidentally create a closure with a lambda function.</div>
</div><br><div>Oscar</div>