-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-125916: Adapt functools.reduce() to Argument Clinic #125999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This coming from #125917. Red alert: to make AC happy, docstring was adjusted. I did some benchmarks. # a.py
import pyperf
from functools import reduce
f = lambda x, y: x + y
lst = list(range(5))
init = 123
runner = pyperf.Runner()
runner.bench_func('reduce(f, lst)', reduce, f, lst)
runner.bench_func('reduce(f, lst, init)', reduce, f, lst, init) Run e.g. with: with results:
So, at least AC-backed argument processing offer some speedup. |
Thanks Sergey, I'll review this within today. Ping me tomorrow if I forget. |
PEP 257 says that "Multi-line docstrings consist of a summary line just like a one-line docstring, followed by a blank line, followed by a more elaborate description." This is also a requirement from the Argument Clinic.
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Yak-shave in preparation for Argument Clinic adaption in pythongh-125999. (cherry picked from commit 9b14083) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Yak-shave in preparation for Argument Clinic adaption in pythongh-125999. (cherry picked from commit 9b14083) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
I'll give Jelle and Serhiy a chance to chime in again before landing this. |
I plan to land this later today (post noon ET). |
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Thanks for the PR, Sergey; thanks for the reviews, Jelle and Serhiy. |
Yak-shave in preparation for Argument Clinic adaption in pythongh-125999.
Yak-shave in preparation for Argument Clinic adaption in pythongh-125999.
functools.reduce
s 'initial' to be a keyword argument #125916