Title: Nested empty container gets inferred to `object` · Issue #5045 · python/mypy · GitHub
Open Graph Title: Nested empty container gets inferred to `object` · Issue #5045 · python/mypy
X Title: Nested empty container gets inferred to `object` · Issue #5045 · python/mypy
Description: Using mypy 0.600, running mypy on x = [[], [1, 2], [3, 4]] reveal_type(x) shows test.py:2: error: Revealed type is 'builtins.list[builtins.object*]' If this doesn't have the empty list, then mypy infers 'builtins.list[builtins.list*[buil...
Open Graph Description: Using mypy 0.600, running mypy on x = [[], [1, 2], [3, 4]] reveal_type(x) shows test.py:2: error: Revealed type is 'builtins.list[builtins.object*]' If this doesn't have the empty list, then mypy i...
X Description: Using mypy 0.600, running mypy on x = [[], [1, 2], [3, 4]] reveal_type(x) shows test.py:2: error: Revealed type is 'builtins.list[builtins.object*]' If this doesn't have the empty list,...
Opengraph URL: https://github.com/python/mypy/issues/5045
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Nested empty container gets inferred to `object`","articleBody":"Using `mypy 0.600`, running `mypy` on\r\n```python\r\nx = [[], [1, 2], [3, 4]]\r\nreveal_type(x)\r\n```\r\nshows \r\n\r\n```\r\ntest.py:2: error: Revealed type is 'builtins.list[builtins.object*]'\r\n```\r\n\r\nIf this doesn't have the empty list, then `mypy` infers `'builtins.list[builtins.list*[builtins.int]]'` for\r\n\r\n```python\r\nx = [[1, 2], [3, 4]]\r\nreveal_type(x)\r\n```\r\n\r\nIdeally, `mypy` would be able to infer `List[List[int]]` even when there's an empty list.","author":{"url":"https://github.com/alanhdu","@type":"Person","name":"alanhdu"},"datePublished":"2018-05-14T20:41:50Z","url":"https://github.com/python/mypy/issues/5045"}
| 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:4965a823-dcea-e785-cf76-95881a7a7caf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8108:1A2F85:C1F3ED:10495C6:6B004ECD |
| html-safe-nonce | 27c3cf377e2982728150d6046dfe4c3f69c74b9b663cc87fbf26857d94f594b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTA4OjFBMkY4NTpDMUYzRUQ6MTA0OTVDNjo2QjAwNEVDRCIsInZpc2l0b3JfaWQiOiIyNDkxODcxNjY3MjExNjcwNTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a3512dafac7bfb031d2f88d92271d244bb1baa9a981e376f72cfac34a2878474 |
| hovercard-subject-tag | issue:322973442 |
| 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/5045/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6c7810a8e38c2b4f7443743e9cecd14d85bcf51bf6b90e783f7998c89399ecab/python/mypy/issues/5045 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6c7810a8e38c2b4f7443743e9cecd14d85bcf51bf6b90e783f7998c89399ecab/python/mypy/issues/5045 |
| og:image:alt | Using mypy 0.600, running mypy on x = [[], [1, 2], [3, 4]] reveal_type(x) shows test.py:2: error: Revealed type is 'builtins.list[builtins.object*]' If this doesn't have the empty list, then mypy i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alanhdu |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width