Home  >  Q&A  >  body text

python standard library partial code

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

The code in the python standard library, please ask
newfunc.func = func
newfunc.args = args
newfunc.keywords = keywords
These three sentences seem to be of no use?

黄舟黄舟2711 days ago630

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-05-18 11:04:27

    If it doesn’t work, where do the parameters of newfunc come from when you call it?

    reply
    0
  • Cancelreply