DOC: Ensure that we add documentation also as to the dict for types#18775
DOC: Ensure that we add documentation also as to the dict for types#18775WarrenWeckesser merged 2 commits intonumpy:mainfrom
Conversation
|
OK, this doesn't quite seem to work, because it overshadows the getset of the instance? Hmmm... EDIT: Well, maybe the solution is to add a special case just for |
|
Are metaclasses related at all here, or is this just a heap type problem? |
|
@eric-wieser yeah, that would make sense, but I am not setting the HEAPTYPE flag on |
|
close/reopen |
This ensures that `help(np.dtype)` produces a result. I am not exactly sure why it picks up `__doc__` from the dict instead of `tp_doc` right now. It probably is due to the combination of inheritance and the fact that the dict always includes `None` and gets preference during inheritance. (That probably makes a lot of sense to not inherit the `type` docstring by default.) Modifying the dictionary directly is not really good style, either, but hopefully works. Closes numpygh-18740
abf8ffd to
9975cc8
Compare
|
After chasing around how ufuncs add docstrings (we have a function to do it via Python, which claims it is used but is not actually used)... The only thing that was necessary here was to only put the doc-string into the dict only if the dict contains This actually means/fixes that |
WarrenWeckesser
left a comment
There was a problem hiding this comment.
LGTM, thanks @seberg. I noticed one small typo.
Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com>
|
Thanks @seberg. |
This ensures that
help(np.dtype)produces a result. I am notexactly sure why it picks up
__doc__from the dict instead oftp_docright now. It probably is due to the combination ofinheritance and the fact that the dict always includes
Noneand gets preference during inheritance.
(That probably makes a lot of sense to not inherit the
typedocstring by default.)
Modifying the dictionary directly is not really good style, either,
but hopefully works.
Closes gh-18740