def partial(func, args, *keywords):
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
python標準函式庫裡面的程式碼,請問
newfunc.func = func
newfunc.args = args
newfunc.keywords = keywords
這三句話好像沒什麼用處?
沒有用的話,你呼叫的時候,newfunc的參數從哪裡來呢