question about what lamda does
Steve Holden
steve at holdenweb.com
Tue Jul 18 11:56:25 EDT 2006
grebekel at gmail.com 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 to a function"?
There is nothing wrong with
def adder(x):
def func(y):
return x+y
return func
for example. Then adder(5) returns a function that returns 5 more than
its argument.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the Python-list
mailing list