Difference between def and lambda Function declaration
Here is an example. Is There any difference? https://share.cocalc.com/share/a3f14e...
Here is an example. Is There any difference? https://share.cocalc.com/share/a3f14e...
I am sorry that i can not access to the cocalc file. The difference is basically that a lambda function is anonymous: you do not need to give it a name to use it in a function.
For example, if a function named foo takes a function as input, you can do:
def f(x):
return blah
foo(f)
or
foo(lambda x : blah)
In the first construction, you have to give the name f to define the function, in the second case, you can pass the function to foo without having to give it a name first.
Asked: 2019-01-21 14:44:40 +0100
Seen: 1,338 times
Last updated: Jan 21 '19
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
There does not seem to be anything at the end of the link you provided.