Title: `isinstance` can take `typing.Union` as second arg in 3.10 and newer · Issue #12137 · python/typeshed · GitHub
Open Graph Title: `isinstance` can take `typing.Union` as second arg in 3.10 and newer · Issue #12137 · python/typeshed
X Title: `isinstance` can take `typing.Union` as second arg in 3.10 and newer · Issue #12137 · python/typeshed
Description: Currently it allows for types.UnionType but not typing.Union if sys.version_info >= (3, 10): _ClassInfo: TypeAlias = type | types.UnionType | tuple[_ClassInfo, ...] else: _ClassInfo: TypeAlias = type | tuple[_ClassInfo, ...] def isinstan...
Open Graph Description: Currently it allows for types.UnionType but not typing.Union if sys.version_info >= (3, 10): _ClassInfo: TypeAlias = type | types.UnionType | tuple[_ClassInfo, ...] else: _ClassInfo: TypeAlias = ty...
X Description: Currently it allows for types.UnionType but not typing.Union if sys.version_info >= (3, 10): _ClassInfo: TypeAlias = type | types.UnionType | tuple[_ClassInfo, ...] else: _ClassInfo: TypeAlias =...
Opengraph URL: https://github.com/python/typeshed/issues/12137
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`isinstance` can take `typing.Union` as second arg in 3.10 and newer","articleBody":"Currently it allows for `types.UnionType` but not `typing.Union`\r\n```\r\nif sys.version_info >= (3, 10):\r\n _ClassInfo: TypeAlias = type | types.UnionType | tuple[_ClassInfo, ...]\r\nelse:\r\n _ClassInfo: TypeAlias = type | tuple[_ClassInfo, ...]\r\n\r\ndef isinstance(obj: object, class_or_tuple: _ClassInfo, /) -> bool: ...\r\n```\r\n\r\nI think mypy currently assumes that whatever typeshed says for isinstance has no false positives","author":{"url":"https://github.com/hauntsaninja","@type":"Person","name":"hauntsaninja"},"datePublished":"2024-06-13T21:03:08Z","url":"https://github.com/python/typeshed/issues/12137"}
| 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:74dd30de-ce7d-574d-c620-afad08289854 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8504:1AC37C:D1AC82:1186501:6B005308 |
| html-safe-nonce | 05c40ef9fbadd678ae2c0fbc6d1ee0e137fb767828d1e5328b64ef1b84b1c962 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTA0OjFBQzM3QzpEMUFDODI6MTE4NjUwMTo2QjAwNTMwOCIsInZpc2l0b3JfaWQiOiI4NDAxOTgwNjk5Mjc1NjQwNDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e40f936bf625906b659fab465a69cb904e645bd620ee45be3504a2a233540cef |
| hovercard-subject-tag | issue:2352062754 |
| 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/12137/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e268dc8251f66f0cc934e4ea4f2a9b23824688d5a1601a13a23054cc41799f9d/python/typeshed/issues/12137 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e268dc8251f66f0cc934e4ea4f2a9b23824688d5a1601a13a23054cc41799f9d/python/typeshed/issues/12137 |
| og:image:alt | Currently it allows for types.UnionType but not typing.Union if sys.version_info >= (3, 10): _ClassInfo: TypeAlias = type | types.UnionType | tuple[_ClassInfo, ...] else: _ClassInfo: TypeAlias = ty... |
| 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 | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width