Title: Mypy cannot infer type of `[[], [1]]` · Issue #2255 · python/mypy · GitHub
Open Graph Title: Mypy cannot infer type of `[[], [1]]` · Issue #2255 · python/mypy
X Title: Mypy cannot infer type of `[[], [1]]` · Issue #2255 · python/mypy
Description: mypy 0.4.5, CPython 3.4.4 Running the code with mypy results in an error: x = [[], [1]] for b in x: reveal_type(b) # error: Revealed type is 'builtins.object*' b + [1] # error: Unsupported left operand type for + ("object") This might be...
Open Graph Description: mypy 0.4.5, CPython 3.4.4 Running the code with mypy results in an error: x = [[], [1]] for b in x: reveal_type(b) # error: Revealed type is 'builtins.object*' b + [1] # error: Unsupported left ope...
X Description: mypy 0.4.5, CPython 3.4.4 Running the code with mypy results in an error: x = [[], [1]] for b in x: reveal_type(b) # error: Revealed type is 'builtins.object*' b + [1] # error: Unsupported ...
Opengraph URL: https://github.com/python/mypy/issues/2255
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mypy cannot infer type of `[[], [1]]`","articleBody":"mypy 0.4.5, CPython 3.4.4\n\nRunning the code with mypy results in an error:\n\n``` python\nx = [[], [1]]\nfor b in x:\n reveal_type(b) # error: Revealed type is 'builtins.object*'\n b + [1] # error: Unsupported left operand type for + (\"object\")\n```\n\nThis might be me misunderstanding the type system, but I would have expected mypy to ask for type annotations if it can't infer the type, e.g.:\n\n> error: Need type annotation for variable\n\nI'm also wondering why it infers an object, when it could (should?) be a list instead.\n","author":{"url":"https://github.com/squiddy","@type":"Person","name":"squiddy"},"datePublished":"2016-10-14T20:43:17Z","url":"https://github.com/python/mypy/issues/2255"}
| 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:3afeb074-2c93-b471-5aac-aa471fedf30c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A410:29A20E:2C6C4A8:3CAA60B:6B005971 |
| html-safe-nonce | 7916e404f0c9a73d692dbdcd4964a555e6e59b7da317c139df8ec21fe01602f6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDEwOjI5QTIwRToyQzZDNEE4OjNDQUE2MEI6NkIwMDU5NzEiLCJ2aXNpdG9yX2lkIjoiMzY4MTIyODM3MjU1MTE2MjIyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 246731c37771668877327537bc3449964d58e6ac0c156d6384b2318f90ce9f01 |
| hovercard-subject-tag | issue:183145960 |
| 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/2255/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b3e20d3f799e1e7453f065486e85bf64026a9b994f857a67d42cdbd313c49b87/python/mypy/issues/2255 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b3e20d3f799e1e7453f065486e85bf64026a9b994f857a67d42cdbd313c49b87/python/mypy/issues/2255 |
| og:image:alt | mypy 0.4.5, CPython 3.4.4 Running the code with mypy results in an error: x = [[], [1]] for b in x: reveal_type(b) # error: Revealed type is 'builtins.object*' b + [1] # error: Unsupported left ope... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | squiddy |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width