-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
add example of a good docstring for defaults and examples #12356
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
615824b
add example of a good docstring for defaults and examples
adrinjalali 620de77
Merge remote-tracking branch 'upstream/master' into doc/developers
adrinjalali 71cb6b3
trying Thomas's proposal
adrinjalali 8023851
apply comments, add example
adrinjalali 1ece81a
further simplify and clarify instructions
adrinjalali 76a7273
add default and an easy example
adrinjalali 74e581f
Merge remote-tracking branch 'upstream/master' into doc/developers
adrinjalali 19ba145
tab -> spaces
adrinjalali 0256ea1
address comments
adrinjalali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
uhh did we have a discussion of "of shape" vs "shape=". Did someone count that?
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.
"of shape": 513 lines; "shape=" 338 lines; "shape =" 1316 lines. "of shape =": 162 lines, "of shape=" 1 line.
These are regex matches, so non-exclusive, so "of shape" includes "of shape =".
So we have 350 "of shape (...)" and 1115 "shape = (..)"
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.
Yes
shape=
would result in a smaller diff. Since this PR will result in many docstring changes, we should decide based on which is subjectively better.(I have been +0.25 for
shape=
because it saves a few more characters.) Do you have a opinion on this?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.
My preference is shape= but I don't mind that much.
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.
we are often short on space in that line.
array-like of shape (n_samples,)
vsarray-like, shape=(n_samples,)
saves 2 characters. Not sure if that's a good argument?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.
we can fix those cases that don't comply with this with a
sed
, so I don't think the number of instances of each case are important that much anyway. I kinda liked not having the comma cause the comma is separating other things:int, array-like of shape (n_samples,), or None, default=None
(note that we don't have the oxford comma in our guide now, but I rather have it)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.
I prefer
of shape
if there is no comma. I find it more difficult to visually parse it.I also find it closer to literal English --- even if we are writing documentation for expert computer scientists (I should not troll about Matlab post).
Anyway, I am going with the consensus (since it is merged it seems we are going for that one?)
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.
Ok, fine with keeping it.
@adrinjalali feel free to go ahead and do the sed and then fix all the merge conflicts :P
If whis is the way we want to go, we should probably do the sed.
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.
So are we doing this?
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.
I guess so, I'll submit a PR.