-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Move unrendered docstrings to private attributes. #10233
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
76da091
to
6e5d5e4
Compare
Why are you moving that docstring? |
to hide it from https://matplotlib.org/api/contour_api.html#matplotlib.contour.QuadContourSet.contour_doc (it's now a regular docstring instead of being (from sphinx's PoV) a module-global variable). |
Could the problem also be solved with a moderate change in contour_api.rst, specifying the things to be documented rather than using auto-everything? |
It is not clear to me what you mean in this specific case. I'm basically changing
to
which seems, if anything (regardless of sphinx), better? |
I don't agree that it is better; having a very long docstring between the signature and the code makes it a little harder to work with the code. |
Could probably turn it into a private variable instead. |
Switching to a private variable sounds like a good idea--it hadn't occurred to me! |
Note that using `@property` to deprecate the attributes doesn't really help as we'd want something that also returns the string value when accessed from a class rather than from an instance; while it is technically possible to write such a descriptor that seems a bit overkill...
edited accordingly |
6e5d5e4
to
5733e87
Compare
Thank you for the change in strategy with the contour docstring. What about the tricontour doc string? @ianthomas23 might want to have a look. Side question: In the docstrings themselves, why are the "::" instances mostly separate paragraphs, wasting two full lines, instead of being at the ends of the preceding paragraphs? My understanding from the reSt documentation is that if they are at the end of a paragraph and separated by a space, this is equivalent to having them in their own paragraphs. |
The '::' can definitely be moved into the previous paragraph (and I agree it'll make things more compact). But that should go into a separate PR (to keep the diff of this one clear as a "move-only"). I believe quite strongly that the tricontour docstring belongs directly under the tricontour() signature (for the case of contour() I moved it back out as there wasn't really a place to put it anyways and I had to "invent" a pass-through constructor to host it, which was not particularly elegant either). To be honest I believe that your point about docstrings taking too much place is better solved by having your favorite code editor fold the docstring, e.g. the screenshots at the bottom of https://chrisdown.name/2015/02/26/folding-python-docstrings-in-vim.html (I use https://github.com/tmhedberg/SimpylFold). |
Note that using
@property
to deprecate the attributes doesn't reallyhelp as we'd want something that also returns the string value when
accessed from a class rather than from an instance; while it is
technically possible to write such a descriptor that seems a bit
overkill...
Closes #5873 and #9642.
Note that git thinks that the diff on QuadContourSet is code being moved around but actually I moved the docstring around, it's just that the docstring is longer than the code...
PR Summary
PR Checklist