curring means take a part of argument and return a new function
我们可以用functools.partial来实现python 的 currying化
def add(a,b):
return a + b
from functools import partial
add1 = partial(add, 1)
print add1(5)
curring means take a part of argument and return a new function
我们可以用functools.partial来实现python 的 currying化
def add(a,b):
return a + b
from functools import partial
add1 = partial(add, 1)
print add1(5)
本文标题:python里的currying 化
本文链接:https://www.haomeiwen.com/subject/xejnettx.html
网友评论