]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Simplify partial() rough equivalent code (gh-124941)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Thu, 3 Oct 2024 19:54:53 +0000 (14:54 -0500)
committerGitHub <noreply@github.com>
Thu, 3 Oct 2024 19:54:53 +0000 (19:54 +0000)
Doc/library/functools.rst

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