Heim  >  Fragen und Antworten  >  Hauptteil

Teilcode der Python-Standardbibliothek

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

Der Code in der Python-Standardbibliothek, bitte
newfunc.func = func
newfunc.args = args
newfunc.keywords = keywords
Diese drei Sätze scheinen wenig nützlich zu sein?

黄舟黄舟2711 Tage vor632

Antworte allen(1)Ich werde antworten

  • 巴扎黑

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

    没有用的话,你调用的时候,newfunc的参数从哪里来呢

    Antwort
    0
  • StornierenAntwort