mirror of https://github.com/python/cpython
Simplify partial() rough equivalent code (gh-124941)
This commit is contained in:
parent
1f9025a4e7
commit
7ecaf21946
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue