Title: Need for a few corrections/updates regarding the `inspect.ismethoddescriptor()`'s and `inspect.isdatadescriptor()`'s docs and unit tests · Issue #122102 · python/cpython · GitHub
Open Graph Title: Need for a few corrections/updates regarding the `inspect.ismethoddescriptor()`'s and `inspect.isdatadescriptor()`'s docs and unit tests · Issue #122102 · python/cpython
X Title: Need for a few corrections/updates regarding the `inspect.ismethoddescriptor()`'s and `inspect.isdatadescriptor()`'s docs and unit tests · Issue #122102 · python/cpython
Description: Documentation 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() ar...
Open Graph Description: Documentation 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(), i...
X Description: Documentation 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(), i...
Opengraph URL: https://github.com/python/cpython/issues/122102
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Need for a few corrections/updates regarding the `inspect.ismethoddescriptor()`'s and `inspect.isdatadescriptor()`'s docs and unit tests","articleBody":"# Documentation\r\n\r\n1. The main correction that needs to be made regards this fragment of the docs of [inspect.ismethoddescriptor()](https://docs.python.org/3.14/library/inspect.html#inspect.ismethoddescriptor):\r\n\r\n \u003e Return `True` if the object is a method descriptor, but not if [ismethod()](https://docs.python.org/3.14/library/inspect.html#inspect.ismethod), [isclass()](https://docs.python.org/3.14/library/inspect.html#inspect.isclass), [isfunction()](https://docs.python.org/3.14/library/inspect.html#inspect.isfunction) or [isbuiltin()](https://docs.python.org/3.14/library/inspect.html#inspect.isbuiltin) are true.\r\n\r\n 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).\r\n\r\n (As it seems, the mistaken statement was introduced [long ago](https://github.com/python/cpython/issues/49218)...)\r\n\r\n2. Another thing worth fixing is the lack of the information that the [inspect.isdatadescriptor()](https://docs.python.org/3.14/library/inspect.html#inspect.isdatadescriptor) function *also* returns False if any of the [ismethod()](https://docs.python.org/3.14/library/inspect.html#inspect.ismethod), [isclass()](https://docs.python.org/3.14/library/inspect.html#inspect.isclass) or [isfunction()](https://docs.python.org/3.14/library/inspect.html#inspect.isfunction) tests are true.\r\n\r\n3. 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...\r\n\r\n4. Naturally, it also seems a good idea to update the docstrings of those two functions (where applicable).\r\n\r\nAll those improvements have been proposed by submitting [the first PR attached to this issue](https://github.com/python/cpython/pull/122104/files).\r\n\r\n# Tests\r\n\r\nBy the way, it seems worth to make the unit tests for those two functions be *more comprehensive* as well as *consistent with each other*.\r\n\r\nThe tests-related improvements have been proposed by submitting [the second PR attached to this issue](https://github.com/python/cpython/pull/122144/files).\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-122104\r\n* gh-122144\r\n\u003c!-- /gh-linked-prs --\u003e\r\n","author":{"url":"https://github.com/zuo","@type":"Person","name":"zuo"},"datePublished":"2024-07-21T22:31:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/122102/cpython/issues/122102"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1129e16e-cc6c-a8e9-5070-c6207b2b5bd2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A75E:297F82:14B5582:1CA4DB9:696AA3BD |
| html-safe-nonce | d57576771f65ce9bc14f7e810134044eb5101df5dc5ea3f37250b44b12e19c8b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzVFOjI5N0Y4MjoxNEI1NTgyOjFDQTREQjk6Njk2QUEzQkQiLCJ2aXNpdG9yX2lkIjoiNTI2NjY5MTYzMTE3MDEwMjIwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e3b9a4002f67d61d8629689d1c02c29af811c14e343e4d7a1dc3e9ec7c4365b6 |
| hovercard-subject-tag | issue:2421627540 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/122102/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f76bb0a62a95bdc0dde07680f9fc562800d459c5f1f1f9a485c0d10f6f83bd77/python/cpython/issues/122102 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f76bb0a62a95bdc0dde07680f9fc562800d459c5f1f1f9a485c0d10f6f83bd77/python/cpython/issues/122102 |
| og:image:alt | Documentation 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(), i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zuo |
| hostname | github.com |
| expected-hostname | github.com |
| None | a51f97dbb9326f71c08ecb61577457d543c602124d1a2672871258ef37ac5261 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4bd0eac606c70914085176ef312ebdcd97a8cdf1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width