Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,
Please look at the code below:

a = lambda x:x%2


When i typed:

print a(2)

the output was :
0

So does this mean that a lambda expression returns a reference to function definition? which means that 'a' will become the function which contains the definition : 'x:x%2'.

Is my understanding correct?

Thanks and Regards,
Rahul
Posted

1 solution

That is correct. For more info check this link:
http://www.secnetix.de/olli/Python/lambda_functions.hawk[^]

Good luck!
 
Share this answer
 
Comments
Rahul VB 20-May-15 9:56am    
Thanks a lot Sir.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900