Title: Support `or` in `isinstance` expressions. · Issue #942 · python/mypy · GitHub
Open Graph Title: Support `or` in `isinstance` expressions. · Issue #942 · python/mypy
X Title: Support `or` in `isinstance` expressions. · Issue #942 · python/mypy
Description: I saw in some place in mypy something like class A: pass class B(A): pass class C(A): pass x = C() # type: A if isinstance(x, B) or isinstance(x, C): y = cast(Union[B, C], x) ... We should be able to infer Union[B, C] as the type of x wi...
Open Graph Description: I saw in some place in mypy something like class A: pass class B(A): pass class C(A): pass x = C() # type: A if isinstance(x, B) or isinstance(x, C): y = cast(Union[B, C], x) ... We should be able ...
X Description: I saw in some place in mypy something like class A: pass class B(A): pass class C(A): pass x = C() # type: A if isinstance(x, B) or isinstance(x, C): y = cast(Union[B, C], x) ... We should be able ...
Opengraph URL: https://github.com/python/mypy/issues/942
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support `or` in `isinstance` expressions.","articleBody":"I saw in some place in mypy something like\n\n```\nclass A:\n pass\n\nclass B(A):\n pass\n\nclass C(A):\n pass\n\nx = C() # type: A\nif isinstance(x, B) or isinstance(x, C):\n y = cast(Union[B, C], x)\n ...\n```\n\nWe should be able to infer `Union[B, C]` as the type of `x` within this expression.\n","author":{"url":"https://github.com/jhance","@type":"Person","name":"jhance"},"datePublished":"2015-10-17T00:51:51Z","url":"https://github.com/python/mypy/issues/942"}
| 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:387d3742-9034-fe75-a684-9d52dce2bf28 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C842:194E10:2414D8F:31237CD:6B003052 |
| html-safe-nonce | cf19bb1a6bf2655f8e81b009549816841e977066e438e8e5f8fb90cf47269e48 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODQyOjE5NEUxMDoyNDE0RDhGOjMxMjM3Q0Q6NkIwMDMwNTIiLCJ2aXNpdG9yX2lkIjoiNjUwMDkwNDQ4NDMyNjA5Mjg4MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 49521e6c6494b9f993d66a317c74fdfa2fb0c8b57d8b9f23aafe720bc3746d79 |
| hovercard-subject-tag | issue:111935015 |
| 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/942/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4898cdf27db6b71d9ef4437438b4cfdd277e8d1efecf57cc5604b65a9b42fcb2/python/mypy/issues/942 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4898cdf27db6b71d9ef4437438b4cfdd277e8d1efecf57cc5604b65a9b42fcb2/python/mypy/issues/942 |
| og:image:alt | I saw in some place in mypy something like class A: pass class B(A): pass class C(A): pass x = C() # type: A if isinstance(x, B) or isinstance(x, C): y = cast(Union[B, C], x) ... We should be able ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jhance |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width