def keep_kwargs_partial(func, *args, **keywords):
def newfunc(*fargs, **fkeywords):<EOL><INDENT>newkeywords = fkeywords.copy()<EOL>newkeywords.update(keywords)<EOL>return func(*(args + fargs), **newkeywords)<EOL><DEDENT>newfunc.func = func<EOL>newfunc.args = args<EOL>newfunc.keywords = keywords<EOL>return newfunc<EOL>
Like functools.partial but instead of using the new kwargs, keeps the old ones.