LAMBDA IS IT USELESS?

Sheila King sheila at spamcop.net
Thu Jul 12 01:48:01 EDT 2001


I'm interested to see what responses you will get to this query, as I
don't fully understand the lambda functions either. However, I'm
currently working through the chapters on Tkinter in Programming Python,
2nd ed., and apparently, there are cases when issuing callbacks for
events, that in order to be able to pass parameters to the callback
function, one must use lambda functions.

I don't entirely understand why, at this time. But it was mentioned in
the book.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/


On Thu, 12 Jul 2001 03:27:21 GMT, "EricIDLE" <grayson-wilson at home.com>
wrote in comp.lang.python in article
<tO837.679712$166.14009323 at news1.rdc1.bc.home.com>:

:Ok well I dont quite grasp the Lambda concept heres an example.
:
:def mult(x,y):
:    return x * y
:f = reduce(lambda x,y: x*y,n)
:print f
:
:*NOTE   The varible N is defined in the code before this excerpt.
:
:Anyways back to the point the book says this is easier!?!?
:
:But comon sense tells me this is easier.
:
:def mult(x,y):
:    return x * y
:f = reduce(mult,n)
:print f
:
:Isnt that easier??
:
:Or do I not get lambda?




More information about the Python-list mailing list