danielx wrote:
> Bruno Desthuilliers wrote:
>
>>danielx wrote:
>>(snip)
>>
>>
>>>Python's lambda really can't be as powerful as Lisp's because Python
>>>does not have expressions that do case analysis (this is not lambda's
>>>fault, of course ;). The reason is that you really want to put each
>>>c
Bruno Desthuilliers wrote:
> danielx wrote:
> (snip)
>
> > Python's lambda really can't be as powerful as Lisp's because Python
> > does not have expressions that do case analysis (this is not lambda's
> > fault, of course ;). The reason is that you really want to put each
> > case on its own set
danielx wrote:
(snip)
> Python's lambda really can't be as powerful as Lisp's because Python
> does not have expressions that do case analysis (this is not lambda's
> fault, of course ;). The reason is that you really want to put each
> case on its own set of lines. This enhances readability at th
hey thanks for that last post, although some of it was a bit over my
head.
i think i am getting more of the differences here.
thanks again,
sk
danielx 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
[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. 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 sample
Steve Holden wrote:
> tac-tics 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. What would i use a lamda for that i
> >>could not or would not use a def for ? Is there a notable di
tac-tics 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. 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
I stand corrected. Not sure where I got that from, improper
defragmentation due to sleep depravation perhaps...
K.S.Sreeram wrote:
> [EMAIL PROTECTED] wrote:
> > The two primary differences between using def and using lambda is that
> > lambda is limited to a single expression and def cannot be us
[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. 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 sample
[EMAIL PROTECTED] wrote:
> The two primary differences between using def and using lambda is that
> lambda is limited to a single expression and def cannot be used within
> another function.
>
Where on earth did you get that from? I presume you mean "You can't use
a def statement as an argument t
[EMAIL PROTECTED] wrote:
> The two primary differences between using def and using lambda is that
> lambda is limited to a single expression and def cannot be used within
> another function.
'def' can certainly be used within another function :
def make_adder( delta ) :
def adder( x ) :
The two primary differences between using def and using lambda is that
lambda is limited to a single expression and def cannot be used within
another function.
Basically, use lambda when you need to define a small function within
another function. I've also used it to create 'shortcut' functions a
so a lamda needs to stay at one expression, and use more than one lamda
for more expressions ?
i think i get it.
sk
Nick Vatamaniuc wrote:
> Use it anywhere a quick definition of a function is needed that can be
> written as an expression. For example when a callback function is
> needed you cou
Use it anywhere a quick definition of a function is needed that can be
written as an expression. For example when a callback function is
needed you could say:
def callback(x,y):
return x*y
some_function(when_done_call_this=callback)
But with lambda you could just write
some_function(when_done_cal
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
[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
Hey there,
i have been learning python for the past few months, but i can seem to
get what exactly a lamda is for. 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.
th
17 matches
Mail list logo