- 发现函数可以设置属性变量, 如下 newfunc.func , newfunc.args
def partial(func, *args, **keywords):
"""Copied from Python standard lib functools.
https://docs.python.org/2/library/functools.html#functools.partial
Simply importing from the standard module caused failure in UDFs.
"""
def newfunc(*fargs, **fkeywords):
newkeywords = keywords.copy()
newkeywords.update(fkeywords)
return func(*(args + fargs), **newkeywords)
newfunc.func = func
newfunc.args = args
newfunc.keywords = keywords
return newfunc