Title: Infer optional type for list with None values · Issue #1863 · python/mypy · GitHub
Open Graph Title: Infer optional type for list with None values · Issue #1863 · python/mypy
X Title: Infer optional type for list with None values · Issue #1863 · python/mypy
Description: This is unexpected: x = [1, None] reveal_type(x) # Revealed type is 'builtins.list[builtins.object*]' I'd expect the list item type to to be Optional[int]. A join of a non-optional type with None should probably produce an optional type.
Open Graph Description: This is unexpected: x = [1, None] reveal_type(x) # Revealed type is 'builtins.list[builtins.object*]' I'd expect the list item type to to be Optional[int]. A join of a non-optional type with None s...
X Description: This is unexpected: x = [1, None] reveal_type(x) # Revealed type is 'builtins.list[builtins.object*]' I'd expect the list item type to to be Optional[int]. A join of a non-optional type...
Opengraph URL: https://github.com/python/mypy/issues/1863
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Infer optional type for list with None values","articleBody":"This is unexpected:\n\n```\nx = [1, None]\nreveal_type(x) # Revealed type is 'builtins.list[builtins.object*]'\n```\n\nI'd expect the list item type to to be `Optional[int]`. A join of a non-optional type with `None` should probably produce an optional type.\n","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2016-07-14T14:32:18Z","url":"https://github.com/python/mypy/issues/1863"}
| 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:b9572ab5-53f3-f7fd-ac1d-5168f15d17ad |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B05E:1E3154:3A8204:4ECA58:6B002962 |
| html-safe-nonce | abc3db381068c86c89a4a8161dcc8271ec909cb26ac32aaa9c308d2357c0a20e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDVFOjFFMzE1NDozQTgyMDQ6NEVDQTU4OjZCMDAyOTYyIiwidmlzaXRvcl9pZCI6IjY1NjU1NDQwMzQxODg2NjcyMzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 95b948eb26498fbd12306d14461e2bbebbeb9bff11fee1f7136eb66b2598044b |
| hovercard-subject-tag | issue:165576261 |
| 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/1863/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3792db999f479243d57afb7e3924655b4583a281f597e938814a1d71497ecb1f/python/mypy/issues/1863 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3792db999f479243d57afb7e3924655b4583a281f597e938814a1d71497ecb1f/python/mypy/issues/1863 |
| og:image:alt | This is unexpected: x = [1, None] reveal_type(x) # Revealed type is 'builtins.list[builtins.object*]' I'd expect the list item type to to be Optional[int]. A join of a non-optional type with None s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| 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