0

i've been looking at the lambda function lately.

I see that its similar to an anonymous function which is generally used to pass into a higher order function.

Is there any difference in this function compared to the normal function?

Malemna
  • 75
  • 1
  • 6
  • A lambda expression is used to create anonymous functions. There is nothing about the resulting function object that is different or special compared to a function created using a full, function definition statement. The only way you could probably tell it was created using a lambda expression is that the `.__name__` attribute will be `''`. It is a convenience – juanpa.arrivillaga Mar 30 '21 at 17:10
  • lambda function has some restricions. For example it can't use `=` to assing value to variable. It can't use `if` without `else` - only special version `value1 if state else value2`. Probably It can't use `return` to exit in different moments. For more complex code normal function can be more useful and more readable - and simpler do debug. – furas Mar 30 '21 at 17:38

0 Answers0