Need for a few corrections/updates regarding the `inspect.ismethoddescriptor()`'s and `inspect.isdatadescriptor()`'s docs and unit tests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Documentation
-
The main correction that needs to be made regards this fragment of the docs of inspect.ismethoddescriptor():
Return
Trueif the object is a method descriptor, but not if ismethod(), isclass(), isfunction() or isbuiltin() are true.The problem is that, in fact, the
inspect.ismethoddescriptor()function does not engage theinspect.isbuiltin()function at all (whereas it does engage the rest of the said functions).(As it seems, the mistaken statement was introduced long ago...)
-
Another thing worth fixing is the lack of the information that the inspect.isdatadescriptor() function also returns False if any of the ismethod(), isclass() or isfunction() tests are true.
-
There are also a few other fragments of the docs of those two functions (
inspect.ismethoddescriptor()andinspect.isdatadescriptor()) which seem to me worth updating/rewording... -
Naturally, it also seems a good idea to update the docstrings of those two functions (where applicable).
All those improvements have been proposed by submitting the first PR attached to this issue [update: merged].
Tests
By the way, it seems worth to make the unit tests for those two functions be more comprehensive as well as consistent with each other.
The tests-related improvements have been proposed by submitting the second PR attached to this issue.
Linked PRs
- gh-122104
- gh-122144
- gh-153948
- gh-153949
- gh-153950
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the documentation and docstrings for inspect.ismethoddescriptor() and inspect.isdatadescriptor(), then review the existing unit tests for both functions. The linked PRs describe or contain the proposed documentation and test updates; the work is done when those corrections and more consistent coverage are merged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, testing
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100