The documentation for functools.partial says that it is "roughly equivalent to":
def partial(func, *args, **keywords):
def newfunc(*fargs, **fkeywords):
newkeywords = keywords.copy()
newkeywords.update(fkeywords)
return func(*(args + fargs), **newkeywords) # line to change
newfunc.func = func
newfunc.args = args
newfunc.keywords = keywords
return newfunc
If I wanted to implement a version that prepends the additional arguments, it seems like I'd just have to change the indicated line.
Are there any other features/gotchas that I should be worried about in just copying this code?