[Tutor] Why use lambda?

Shrutarshi Basu technorapture at gmail.com
Sat Aug 2 17:42:10 CEST 2008


>From what I've seen, Lambda is most useful if you're passing functions
as arguments to other functions. You could use lambda to create a
function on-the-fly, as you've said, and that will save you the
trouble of having to write it separately. Try looking for examples on
functional programming in Python to find more examples.

On Sat, Aug 2, 2008 at 10:40 AM, desmond mansfield <desm at hotmail.co.uk> wrote:
>
> I've read some small tutorials on lambda, and how I can use it to define functions "on-the-fly".
> But what I don't understand, and cannot seem to find an answer to, is why I'd actually want to use it ?
>
> What can lambda do that normal function definitions cannot?
> Is it quicker to execute/less memory intensive?
> Or is it just quicker to type and easier to think about?
>
> Any answers would be appreciated. thanks,
> _________________________________________________________________
> Make a mini you on Windows Live Messenger!
> http://clk.atdmt.com/UKM/go/107571437/direct/01/
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
The ByteBaker :
http://www.bytebaker.com


More information about the Tutor mailing list