python basis - anonymous function

DEF Calc (X):
     return X +. 1 

A = Calc (10 )
 Print (Calc)
 Print ( the lambda : X + X. 1 memory address) #lambda function by the function name can be passed as the value of variable 
B = the lambda X: X +. 1
 Print (B (10 )) 


name = " Alex " 
# DEF Change_Name (X): 
#      return X + '_ SB' 
# 
# 
# RES = Change_Name (name) 
# Print (RES) 


FUNC = the lambda X: X + ' _sb ' 
Print (FUNC (name))


F = the lambda X, Y: X + Y
 Print (F (1,2 ))
 
Fun = the lambda X, Y, Z: (X +. 1,. 1 + Y, + Z. 1) # the lambda function needs to return multiple values required parentheses represent tuples returned 
Print (Fun (l, 2,3 )) 


# DEF Ti (): 
#      return l, 2,3 ---> (l, 2,3) Python function by default tuples returned as 
# A Ti = () 
# Print (A)

 

Guess you like

Origin www.cnblogs.com/tangcode/p/10984042.html