Code-talk function -python

  • Found property variable function may be provided, as 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

Guess you like

Origin www.cnblogs.com/bregman/p/11811329.html