Title: Functions that are actually classes · Issue #5145 · python/typeshed · GitHub
Open Graph Title: Functions that are actually classes · Issue #5145 · python/typeshed
X Title: Functions that are actually classes · Issue #5145 · python/typeshed
Description: @hatal175 has been fixing several typeshed definitions and was recently looking at itertools. Many documented-as-functions in itertools are currently functions in typeshed, but actually classes at runtime, e.g. itertools.count. The propo...
Open Graph Description: @hatal175 has been fixing several typeshed definitions and was recently looking at itertools. Many documented-as-functions in itertools are currently functions in typeshed, but actually classes at ...
X Description: @hatal175 has been fixing several typeshed definitions and was recently looking at itertools. Many documented-as-functions in itertools are currently functions in typeshed, but actually classes at ...
Opengraph URL: https://github.com/python/typeshed/issues/5145
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Functions that are actually classes","articleBody":"@hatal175 has been fixing several typeshed definitions and was recently looking at itertools. Many documented-as-functions in itertools are currently functions in typeshed, but actually classes at runtime, e.g. `itertools.count`. The proposed change is to make them classes.\r\n\r\nPros:\r\n1) Makes typeshed consistent with runtime (albeit undocumented facet of the runtime)\r\n2) Allows users to do things that depend on these being classes, e.g. type checkers will understand `isinstance(x, itertools.count)` (admittedly rare)\r\n\r\nCons:\r\n1) Change can cause annoying false positives because type checkers are often strict about redefinition. E.g. https://github.com/python/mypy/pull/10255\r\n\r\nMy opinion is that we do nothing (except for maybe linking this issue in the allowlists ;-) ), since I think the con has a more real impact than the pros. Curious for others' thoughts?","author":{"url":"https://github.com/hauntsaninja","@type":"Person","name":"hauntsaninja"},"datePublished":"2021-03-28T05:35:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/5145/typeshed/issues/5145"}
| 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:a79ff0ee-fc16-5f77-948d-23cd23b9c702 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA8E:F5C1C:B7B7C3:FFEDB3:696A1DBD |
| html-safe-nonce | 3aae2b762fcea70c8eea9a6fcd0ffc58e7550a593c2976d588bbba9ea9295890 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQThFOkY1QzFDOkI3QjdDMzpGRkVEQjM6Njk2QTFEQkQiLCJ2aXNpdG9yX2lkIjoiODY5OTM4NjI5MDUwNDM0Mjk3MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f586eaa02529c51f5b7e55f27f22be37b708c74ca01707102b9a7f4e200e3cd5 |
| hovercard-subject-tag | issue:842668117 |
| 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/typeshed/5145/issue_layout |
| twitter:image | https://opengraph.githubassets.com/237e2fa1f120bdc9935631baa82a1ced72f6156f5e570fc16d844bae1b805924/python/typeshed/issues/5145 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/237e2fa1f120bdc9935631baa82a1ced72f6156f5e570fc16d844bae1b805924/python/typeshed/issues/5145 |
| og:image:alt | @hatal175 has been fixing several typeshed definitions and was recently looking at itertools. Many documented-as-functions in itertools are currently functions in typeshed, but actually classes at ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hauntsaninja |
| hostname | github.com |
| expected-hostname | github.com |
| None | 014f3d193f36b7d393f88ca22d06fbacd370800b40a547c1ea67291e02dc8ea3 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| 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 | d515f6f09fa57a93bf90355cb894eb84ca4f458f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width