Simplify partial() rough equivalent code (gh-124941)

This commit is contained in:
Raymond Hettinger 2024-10-03 14:54:53 -05:00 committed by GitHub
parent 1f9025a4e7
commit 7ecaf21946
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 2 deletions

View File

@ -347,8 +347,7 @@ The :mod:`functools` module defines the following functions:
def partial(func, /, *args, **keywords): def partial(func, /, *args, **keywords):
def newfunc(*more_args, **more_keywords): def newfunc(*more_args, **more_keywords):
keywords_union = {**keywords, **more_keywords} return func(*args, *more_args, **(keywords | more_keywords))
return func(*args, *more_args, **keywords_union)
newfunc.func = func newfunc.func = func
newfunc.args = args newfunc.args = args
newfunc.keywords = keywords newfunc.keywords = keywords