Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Doc/library/functools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code looks confusing to me, because ** is closer to keywords than |. According to the PEP 8 style it looks like (**keywords) | more_keywords rather than **(keywords | more_keywords). I think it will be confusing for many readers.

To avoid confusion, you can add parentheses. Or leave the code as it is.

newfunc.func = func
newfunc.args = args
newfunc.keywords = keywords
Expand Down
Loading