ok, i think i get it.
pretty cool.
thanks
-sk

Dan Bishop wrote:
> [EMAIL PROTECTED] wrote:
> > Hey there,
> > i have been learning python for the past few months, but i can seem to
> > get what exactly a lamda is for.
>
> It defines a function.
>
> f = lambda x, y: expression
>
> is equivalent to
>
> def f(x, y):
>    return expression
>
> Note that lambda is an expression while def is a statement.
>
> > What would i use a lamda for that i
> > could not or would not use a def for ? Is there a notable difference ?
> > I only ask because i see it in code samples on the internet and in
> > books.
>
> Lambdas are typically used as parameters to functions that take
> functions as arguments, like property() and reduce().  You never *need*
> to use one, but sometimes it's convenient.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to