Skip to content

gh-125028: Prohibit placeholders in partial keywords - #125197

Closed
dg-pb wants to merge 3 commits into
python:mainfrom
dg-pb:gh-125028-prohibit-kw-placeholders
Closed

gh-125028: Prohibit placeholders in partial keywords#125197
dg-pb wants to merge 3 commits into
python:mainfrom
dg-pb:gh-125028-prohibit-kw-placeholders

Conversation

@dg-pb

@dg-pbdg-pb commented Oct 9, 2024

Copy link
Copy Markdown
Contributor

Slight initialization penalty for vanilla case, but slightly faster for subclass optimization.

Bench

S="from functools import partial, Placeholderf = lambda a, b: Nonep = partial(f, a=1)"
C0='partial(f, a=1)'
C1='partial(p, b=2)'# BEFORE | AFTER$PYEXE -m timeit -s $S$C0# 180 ns | 210 ns$PYEXE -m timeit -s $S$C1# 280 ns | 250 ns

Comment threadModules/_functoolsmodule.c
@dg-pb

Copy link
Copy Markdown
ContributorAuthor

Not planned.

@dg-pbdg-pb closed this Oct 26, 2024
@dg-pb
dg-pb deleted the gh-125028-prohibit-kw-placeholders branch October 26, 2024 04:34
@dg-pb
dg-pb restored the gh-125028-prohibit-kw-placeholders branch October 27, 2024 00:18
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@dg-pb@ZeroIntensity