正在加载图片...
Lambda Expressions vs def Statements square lambda x:xx def square(x): return xx Global frame →func5x)<1ine1>【parent=-Global] Global frame →func{squarex) square (square) [parent=Global] Both create a function with the same behavior The parent frame of each function is the frame in which they were defined Both bind the function to the same name) Only the def statement gives the function an intrinsic nameLambda Expressions vs def Statements ● Both create a function with the same behavior ● The parent frame of each function is the frame in which they were defined ● Both bind the function to the same name def square(x): return x * x square = lambda x: x * x ● Only the def statement gives the function an intrinsic name
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有