Title: Unintended consequences of eliminating promotions with isinstance? · Issue #6180 · python/mypy · GitHub
Open Graph Title: Unintended consequences of eliminating promotions with isinstance? · Issue #6180 · python/mypy
X Title: Unintended consequences of eliminating promotions with isinstance? · Issue #6180 · python/mypy
Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.
Open Graph Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.
X Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.
Opengraph URL: https://github.com/python/mypy
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unintended consequences of eliminating promotions with isinstance?","articleBody":"Previously, the following code:\r\n```\r\ndef foo(x):\r\n # type: (unicode) -> None\r\n if isinstance(x, str):\r\n reveal_type(x)\r\n else:\r\n reveal_type(x)\r\n```\r\nwould emit the expected types (str, unicode) in each branch\r\nPost #6114, which removed the use of promotions when doing isinstance,\r\nit only emits that the type is unicode and skips checking the first branch.\r\n\r\nIs this bad? Should we be doing something else? Obviously str is not really a subtype of unicode, but there are a lot of places where things declared unicode can actually be str.\r\n\r\nI think the intention with the first fix was to mostly to fix Union-related issues, so maybe we need a special case for non-unions? Argh.\r\n\r\nThoughts?","author":{"url":"https://github.com/msullivan","@type":"Person","name":"msullivan"},"datePublished":"2019-01-11T01:26:49Z","url":"https://github.com/python/mypy/issues/6180"}
| 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 | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:ae6e026f-6512-a9a8-0270-63d555f18513 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED14:1833B7:2846E1D:36B6F80:6B004529 |
| html-safe-nonce | ad73e3bb701e74733b248080bed5cae2940e7fbd0b5563e0114431a64e65d603 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDE0OjE4MzNCNzoyODQ2RTFEOjM2QjZGODA6NkIwMDQ1MjkiLCJ2aXNpdG9yX2lkIjoiNjc5Mzk2OTA0MzczNzk1MzU3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4a4f3e65e75eff6e7e46b234639c861789fe9933dad79b7bd66228c5fceccf99 |
| hovercard-subject-tag | repository:7053637 |
| 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/python/mypy/issues/6180 |
| twitter:image | https://opengraph.githubassets.com/f79ae5636353a0db17350af0a02700f2e9c3bbcf096f9450bf0c369c77cd1022/python/mypy |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f79ae5636353a0db17350af0a02700f2e9c3bbcf096f9450bf0c369c77cd1022/python/mypy |
| og:image:alt | Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-cache |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width