8000 gh-125028: Prohibit placeholders in partial keywords by dg-pb · Pull Request #125197 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Conversation

dg-pb
Copy link
Contributor
@dg-pb dg-pb commented Oct 9, 2024

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

Bench

S="
from functools import partial, Placeholder
f = lambda a, b: None
p = 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

@dg-pb
Copy link
Contributor Author
dg-pb commented Oct 26, 2024

Not planned.

@dg-pb dg-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 free to 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
0