Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-125957: sync argument naming in sphinx docs of the cmath and help()#125958

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AA-Turner merged 5 commits intopython:mainfromskirpichev:fix-cmath-sig-125957
Apr 1, 2025

Conversation

skirpichev
Copy link
Member

@skirpichevskirpichev commentedOct 25, 2024
edited by github-actionsbot
Loading

In the main:$ ./python -m timeit -r11 -s 'from cmath import sin;z=1j' 'sin(z)'1000000 loops, best of 11: 312 nsec per loopWith patch:$ ./python -m timeit -r11 -s 'from cmath import sin;z=1j' 'sin(z)'1000000 loops, best of 11: 330 nsec per loop
@skirpichev
Copy link
MemberAuthor

The second commits allowssin(z=1) syntax. This has some overhead:

In the main:$ ./python -m timeit -r11 -s 'from cmath import sin;z=1j' 'sin(z)'1000000 loops, best of 11: 312 nsec per loopWith patch:$ ./python -m timeit -r11 -s 'from cmath import sin;z=1j' 'sin(z)'1000000 loops, best of 11: 330 nsec per loop

Alternative solution: include slashed in the sphinx docs to reflect the actual function signature.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz
Copy link
Member

I'm going offline until Friday so I won't be able to merge it (@vstinner asked me to wait for one other core dev approval before merging so if someone accepts it, they can either merge it or accept the PR and I'll merge it on Friday)

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

PR title:

gh-125957: sync argument naming in sphinx docs of the cmath and help()#125958

It might be interesting to add the/ marker for positional-only parameters.

Example:

>>> import cmath; help(cmath.phase)phase(z, /)    Return argument, also known as the phase angle, of a complex.

@skirpichev
Copy link
MemberAuthor

It might be interesting to add the / marker for positional-only parameters.

I did this once:#101120

This thread discuss an alternative proposal (allow keyword arguments):https://discuss.python.org/t/81003/ See some benchmarks above:#125958 (comment)

@skirpichevskirpichev added needs backport to 3.12only security fixes needs backport to 3.13bugs and security fixes labelsMar 30, 2025
@AA-TurnerAA-Turner merged commit0a3eb88 intopython:mainApr 1, 2025
32 checks passed
@miss-islington-app
Copy link

Thanks@skirpichev for the PR, and@AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestApr 1, 2025
… help() (pythonGH-125958)(cherry picked from commit0a3eb88)Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

GH-131962 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelApr 1, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestApr 1, 2025
… help() (pythonGH-125958)(cherry picked from commit0a3eb88)Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

GH-131963 is a backport of this pull request to the3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12only security fixes labelApr 1, 2025
AA-Turner pushed a commit that referenced this pull requestApr 1, 2025
…d help() (GH-125958) (#131962)gh-125957: sync argument naming in sphinx docs of the cmath and help() (GH-125958)(cherry picked from commit0a3eb88)Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
AA-Turner pushed a commit that referenced this pull requestApr 1, 2025
…d help() (GH-125958) (#131963)gh-125957: sync argument naming in sphinx docs of the cmath and help() (GH-125958)(cherry picked from commit0a3eb88)Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@skirpichevskirpichev deleted the fix-cmath-sig-125957 branchApril 1, 2025 07:24
seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
…d help() (python#125958)Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@rruuaanngrruuaanngrruuaanng left review comments

@vstinnervstinnervstinner approved these changes

@picnixzpicnixzpicnixz approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@skirpichev@picnixz@vstinner@rruuaanng@AA-Turner

[8]ページ先頭

©2009-2025 Movatter.jp