Title: Idea: "Incomplete" marker · Issue #5613 · python/typeshed · GitHub
Open Graph Title: Idea: "Incomplete" marker · Issue #5613 · python/typeshed
X Title: Idea: "Incomplete" marker · Issue #5613 · python/typeshed
Description: When creating stubs, we encourage contributors to leave items unannotated instead of using Any. This often works, but there are cases where you have to fall back on Any, for example: class Foo: def bar(self, some_arg, other_arg=None): se...
Open Graph Description: When creating stubs, we encourage contributors to leave items unannotated instead of using Any. This often works, but there are cases where you have to fall back on Any, for example: class Foo: def...
X Description: When creating stubs, we encourage contributors to leave items unannotated instead of using Any. This often works, but there are cases where you have to fall back on Any, for example: class Foo: def...
Opengraph URL: https://github.com/python/typeshed/issues/5613
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Idea: \"Incomplete\" marker","articleBody":"When creating stubs, we encourage contributors to leave items unannotated instead of using `Any`. This often works, but there are cases where you have to fall back on `Any`, for example:\r\n\r\n```python\r\nclass Foo:\r\n def bar(self, some_arg, other_arg=None):\r\n self.a_field = something()\r\n if some_cond():\r\n return whatever()\r\n else:\r\n return None\r\n```\r\n\r\nIn this case the best we can do is:\r\n\r\n```python\r\nclass Foo:\r\n a_field: Any\r\n def bar(self, some_arg, other_arg: Any | None = ...) -> Any | None: ...\r\n```\r\n\r\nIn this case it's not clear if `Any` is used, because there is no better alternative or because this needs better annotations.\r\n\r\nIdea: We could introduce an alias for `Any` in `_typeshed`, called something like `Incomplete`, `Unknown` (my current favorite), `Something`, `Untyped`, or `Unannotated`. This could clearly mark that this argument type still needs work:\r\n\r\n```python\r\nclass Foo:\r\n some_arg: Unknown\r\n def bar(self, some_arg, other_arg: Unknown | None = ...) -> Unknown | None: ...\r\n```\r\nThis has a few advantages:\r\n\r\n* Communicates that the type is not final and will be improved (and narrowed) in the future.\r\n* Communicates that this particular annotation needs work.\r\n* Gives us a better overview of the completion of stubs and prevents \"lies\". (In fact, an idea I have is to produce graphs that shows the completion percentage of stubs over time.)\r\n* Gives us the ability to grep for `Any` to find areas where the type system could be improved or where newer type system features could be used.","author":{"url":"https://github.com/srittau","@type":"Person","name":"srittau"},"datePublished":"2021-06-10T19:49:42Z","url":"https://github.com/python/typeshed/issues/5613"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:00169630-f9e0-e55b-e2f3-779f105d5768 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC82:73851:5BE19E:7F46D3:6B001BB5 |
| html-safe-nonce | e174866cfe4a5a30c502c3eb349c36fef58ea7bb8e8ea325e050e4ef3ef5a28a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzgyOjczODUxOjVCRTE5RTo3RjQ2RDM6NkIwMDFCQjUiLCJ2aXNpdG9yX2lkIjoiNjk5OTEzNjQwNDkyNDA3NzMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4ca9e0b0a41768132c49675e2082dd03073d780f7f516d0caa6e681db4c4e30e |
| hovercard-subject-tag | issue:917818002 |
| 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/5613/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e95924b42c5d9d6430dbf2e8c4fdf8f8e9804cb8b94965012fdec1e6cf6fc668/python/typeshed/issues/5613 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e95924b42c5d9d6430dbf2e8c4fdf8f8e9804cb8b94965012fdec1e6cf6fc668/python/typeshed/issues/5613 |
| og:image:alt | When creating stubs, we encourage contributors to leave items unannotated instead of using Any. This often works, but there are cases where you have to fall back on Any, for example: class Foo: def... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | srittau |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width