Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Open
@zuo

Description

@zuo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions