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

DOC: Do not use types for *args, **kwargs#585

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
larsoner merged 2 commits intonumpy:mainfromtimhoffm:doc-args-kwargs
Oct 17, 2024

Conversation

@timhoffm
Copy link
Contributor

@timhoffmtimhoffm commentedOct 16, 2024
edited
Loading

Docstrings are primarily intended for the caller, and there *args, **kwargs are not variables with a type but a signature pattern (this is also hinted at by using*args,**kwargs instead ofargs,kwargs as parameter names). It's rather confusing to try and type them, I'd even claim it's misleading and will tempt less experienced programmers to calldef func(*args) with *args declared as tuple with a single tuple argumentfunc((1, 2, 3)).

This omission is also not an information loss for the few people, who look at the signature from the function body perspective (aka developers). That args and kwargs resolve to a tuple / dict in the function is a hard-coded fact.

rossbar reacted with thumbs up emoji
Docstrings are primarily intended for the caller, and there *args, **kwargs are not variables with a type but a signature pattern (this is also hinted at by using *args, **kwargs instead of args, kwargs as parameter names). It's rather confusing to try and type them, I'd even claim it's misleading and will tempt less experienced programmers to call `def func(*args)` with *args declared as tuple with a single tuple argument `func((1, 2, 3))`.This omission is also not an information loss for the few people, who look at the signature from the function body perspective (aka developers). That args and kwargs resolve to a tuple / dict in the function is a hard-coded fact.
Copy link
Contributor

@rossbarrossbar left a comment

Choose a reason for hiding this comment

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

This makes sense to me, thanks@timhoffm .

Also - FWIW the test failures appear to be related to a change in sphinx 8.1 and are unrelated to these changes.

@larsoner
Copy link
Collaborator

Mergedmain into this branch and marking for merge-when-green, thanks in advance@timhoffm !

@larsonerlarsoner merged commit2af51f7 intonumpy:mainOct 17, 2024
25 of 26 checks passed
@stefanvstefanv added this to the1.9.0 milestoneOct 17, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@rossbarrossbarrossbar approved these changes

@larsonerlarsonerlarsoner approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

1.9.0

Development

Successfully merging this pull request may close these issues.

4 participants

@timhoffm@larsoner@rossbar@stefanv

[8]ページ先頭

©2009-2025 Movatter.jp