Skip to content

gh-119109: functools.partial.fallforward fix - #119125

Closed
dg-pb wants to merge 4 commits into
python:mainfrom
dg-pb:fix-issue-119109
Closed

gh-119109: functools.partial.fallforward fix#119125
dg-pb wants to merge 4 commits into
python:mainfrom
dg-pb:fix-issue-119109

Conversation

@dg-pb

@dg-pbdg-pb commented May 17, 2024

Copy link
Copy Markdown
Contributor

#119109

I went with option 1. It is cleaner, faster and has a natural flow.

Before:

fromfunctoolsimportpartialdeffunc(a, b, c=0):
returna-b-cp1=partial(func, 1)
print(p1(2)) # -1%timeitp1(2) # 100 nsp1.keywords['c'] =1print(p1(2)) # -2%timeitp1(2) # 234 nsdelp1.keywords['c']
print(p1(2)) # -1%timeitp1(2) # 144 ns

After:

p1=partial(func, 1)
print(p1(2)) # -1%timeitp1(2) # 100 nsp1.keywords['c'] =1print(p1(2)) # -2%timeitp1(2) # 234 nsdelp1.keywords['c']
print(p1(2)) # -1%timeitp1(2) # 100 ns

Comment threadModules/_functoolsmodule.c Outdated
Comment threadModules/_functoolsmodule.c Outdated
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@dg-pb@sobolevn@nineteendo