Skip to content
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

Need for a few corrections/updates regarding the inspect.ismethoddescriptor()'s and inspect.isdatadescriptor()'s docs and unit tests #122102

Open
zuo opened this issue Jul 21, 2024 · 2 comments
Labels
docs Documentation in the Doc dir

Comments

@zuo
Copy link
Contributor

zuo commented Jul 21, 2024

Documentation

  1. The main correction that needs to be made regards this fragment of the docs of inspect.ismethoddescriptor():

    Return True if 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 the inspect.isbuiltin() function at all (whereas it does engage the rest of the said functions).

    (As it seems, the mistaken statement was introduced long ago...)

  2. 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.

  3. There are also a few other fragments of the docs of those two functions (inspect.ismethoddescriptor() and inspect.isdatadescriptor()) which seem to me worth updating/rewording...

  4. 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.

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

@zuo zuo added the docs Documentation in the Doc dir label Jul 21, 2024
@zuo
Copy link
Contributor Author

zuo commented Jul 21, 2024

PS The documentation fixes/improvements seem worth applying to all supported Python versions: from 3.8 through 3.14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

1 participant