-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Add signatures to docstring examples in the manual #19646
Conversation
Multiplication operator. `x*y*z*...` calls this function with multiple | ||
arguments, i.e. `*(x,y,z...)`. | ||
""" | ||
function *(x, y) | ||
function *(x, y, z...) | ||
# ... [implementation sold separately] ... |
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.
4 space indent these bodies while at 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.
Done.
367c07b
to
f82d5b8
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.
Perhaps retain one example of the single-line "... docstring here..."
syntax? Best!
What for? We don't recommend it, so it sounds confusing to show it in the manual. I guess we will add an example of it when it will be possible to document a type's field (that DocStringExtensions currently supports). |
It is useful? (For example for compact internal documentation?) Why do we not recommend it? Thanks! |
Not sure. Indeed it can be used for internal documentation, but if you add internal docstrings why not add the signature while you're at it? |
I use Perhaps I should just use a single-line comment instead? Please let me know if so, and kindly ignore this suggestion. Thanks! |
We don't really need handwritten signatures above every docstring now that we don't use It is usually useful to have a signature, but there are cases, such as minor internal docs (as mentioned here) and docs that have a really straight forward signature (such as constants) that don't really need them. (Probably worth revisiting the guidelines once everyone has had one some to get used to the new system.) |
These examples did not follow the guidelines given in the rest of the page. Also mark a few code blocks as being Julia code.
f82d5b8
to
443f30d
Compare
Fair enough. I've kept the first one-liner. The confusion which prompted this PR was about the second example anyway, and the guidelines advise explicitly to always include the signature. |
These examples did not follow the guidelines given in the rest
of the page. Also mark a few code blocks as being Julia code.