Title: Idea: allow description of type-effect for functions that return bool · Issue #2357 · python/mypy · GitHub
Open Graph Title: Idea: allow description of type-effect for functions that return bool · Issue #2357 · python/mypy
X Title: Idea: allow description of type-effect for functions that return bool · Issue #2357 · python/mypy
Description: I often encounter situations where I would like to extract some test into a function, but then mypy will not understand the implication on the types of the arguments. This goes against the intention that type checking will guide the prog...
Open Graph Description: I often encounter situations where I would like to extract some test into a function, but then mypy will not understand the implication on the types of the arguments. This goes against the intentio...
X Description: I often encounter situations where I would like to extract some test into a function, but then mypy will not understand the implication on the types of the arguments. This goes against the intentio...
Opengraph URL: https://github.com/python/mypy/issues/2357
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Idea: allow description of type-effect for functions that return bool","articleBody":"I often encounter situations where I would like to extract some test into a function, but then mypy will not understand the implication on the types of the arguments. This goes against the intention that type checking will guide the programmer towards writing more readable code.\n\nSimilar case is functions like callable as in #1973, which requires hard coding so that mypy will understand.\n\nI suggest a `@type_effect` decorator, possibly something along these lines:\n\n```\n@type_effect(true='x \u003c: Callable')\ndef callable(x: object) -> bool: ...\n```\n\nAlthough the syntax is of secondary in this case.\n","author":{"url":"https://github.com/elazarg","@type":"Person","name":"elazarg"},"datePublished":"2016-10-27T22:22:34Z","url":"https://github.com/python/mypy/issues/2357"}
| 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:785cbf6e-739d-f95a-eac9-89de52da7719 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B886:73851:28D31E:3853F0:6B000CAE |
| html-safe-nonce | fc657e7d31837cd7413f3ed4ce66331ff2f4757751ae0ee4e63c21ff23fa85a5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODg2OjczODUxOjI4RDMxRTozODUzRjA6NkIwMDBDQUUiLCJ2aXNpdG9yX2lkIjoiNTIxOTM1MzEzMzAyMDM1MTY2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 01739ae2e1b5d428ddee54347cd90c7a460e629a27f6be009b8375b675fef29f |
| hovercard-subject-tag | issue:185795125 |
| 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/mypy/2357/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1eedb112f7b013d69027502ed259fdb12f6167caa2d3c561ed43a3327a03f856/python/mypy/issues/2357 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1eedb112f7b013d69027502ed259fdb12f6167caa2d3c561ed43a3327a03f856/python/mypy/issues/2357 |
| og:image:alt | I often encounter situations where I would like to extract some test into a function, but then mypy will not understand the implication on the types of the arguments. This goes against the intentio... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | elazarg |
| hostname | github.com |
| expected-hostname | github.com |
| None | cf7ee0062053ad9eb05b6e5de57bd96c2055708bcbada4144946b5ec129cf1d7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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 | 9cab7de176a56362d2aabcbb4d1e07e846eba8a0 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width