标签:
python 柯里化 f(x,y) -> g(x)(y)
def bigger(x): def inner_bigger(y): return y>x return inner_bigger list(filter(bigger(5),range(10))) #filter返回一个迭代器,用list接收 [6, 7, 8, 9] list(filter(bigger(3),range(10))) [4, 5, 6, 7, 8, 9]
实例化一下:
bigger_3 = bigger(3)
bigger_3(4)
True
bigger_3(2)
False
标签:
原文地址:http://www.cnblogs.com/tom-li/p/5287561.html