#常规做法
def sum(a, b, c):
return a + b + c
print sum(1, 2, 3) #6
print sum(4, 5, 6) #15
print '-------'
#lambda表达式
sum = lambda a, b, c: a + b + c
print sum(1, 2, 3) #6
print sum(4, 5, 6) #15
print '-------'
#lambda 参数列表: 表达式
mul =lambda a,b,c:a-b-c
print mul(1,2,3)
print mul(4,2,1)
print '-------'
def fn(x):
return lambda y: x + y
a = fn(2)
print a(3) #5
def sum(a, b, c):
return a + b + c
print sum(1, 2, 3) #6
print sum(4, 5, 6) #15
print '-------'
#lambda表达式
sum = lambda a, b, c: a + b + c
print sum(1, 2, 3) #6
print sum(4, 5, 6) #15
print '-------'
#lambda 参数列表: 表达式
mul =lambda a,b,c:a-b-c
print mul(1,2,3)
print mul(4,2,1)
print '-------'
def fn(x):
return lambda y: x + y
a = fn(2)
print a(3) #5