Lambda函数是否返回函数定义的引用? [英] Does a Lambda Function return the reference of a function definition?
本文介绍了Lambda函数是否返回函数定义的引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,
请看下面的代码:
Hello Friends,
Please look at the code below:
a = lambda x:x%2
输入时:
When i typed:
print a(2)
的输出是:
0
所以这是否意味着lambda表达式返回对函数定义的引用?这意味着'a'将成为包含定义的函数:'x:x%2'。
我的理解是否正确?
谢谢和问候,
Rahul
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
推荐答案
这是正确的。欲了解更多信息,请访问以下链接:
http://www.secnetix.de/olli /Python/lambda_functions.hawk [ ^ ]
祝你好运!
That is correct. For more info check this link:
http://www.secnetix.de/olli/Python/lambda_functions.hawk[^]
Good luck!
这篇关于Lambda函数是否返回函数定义的引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文