-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Make optional in docstrings optional #14862
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
I don't think we have any yet, but we are going to eventually have required keyword arguments. Do we want to call those out as explicitly required? I am 50/50 on this change. See the argument for reducing clutter, but it means you now have to look in two places instead of one to get all of the information you need. |
I‘d point out mandatory kwargs explicitly rather than optional ones. There will be far less mandatory ones, and the „standard“ notion of Python kwargs is optional. Another weak argument for removing optional is that type definitions in numpydoc have to be on a logical line. You run into conflicts more often between the 80 char limit and backslash continuation, which must be continued with 0-indent on the he following line. |
I'm +1 on this change, especially for cases where the default is spelled out on the same line anyways (in which case it's clear it's optional...). |
For reference:
|
Should we be a little more defensive and specific?
|
looks like a good start |
Reworded according to #14862 (comment) |
@tacaswell does the revised version reduce your concern? |
8e9193c
to
ada765b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me.
PR Summary
I think this has been discussed somewhere recently, but I don't remember where.
Numpydoc unconditionally states
Explicitly stating that a parameter is optional is usually not necessary, it's clear from the signature and/or documentation of a default value. Let's remove optional to reduce the clutter in docstrings.
The parantheses in
(float, float)
have already been there, but since this popped up in another discussion, it's reasonable to explicitly mention them here.