Title: Binder should reason about complex expressions · Issue #2199 · python/mypy · GitHub
Open Graph Title: Binder should reason about complex expressions · Issue #2199 · python/mypy
X Title: Binder should reason about complex expressions · Issue #2199 · python/mypy
Description: Here's a very simple example: from typing import * a = ['x', None] # type: List[Optional[str]] for i in range(len(a)): if a[i]: print(i, '<' + a[i] + '>') We get an error on the last line: __tmp__.py:5: error: Unsupported operand types f...
Open Graph Description: Here's a very simple example: from typing import * a = ['x', None] # type: List[Optional[str]] for i in range(len(a)): if a[i]: print(i, '<' + a[i] + '>') We get an error on the last line: __tmp__....
X Description: Here's a very simple example: from typing import * a = ['x', None] # type: List[Optional[str]] for i in range(len(a)): if a[i]: print(i, '<' + a[i] + '>') We get a...
Opengraph URL: https://github.com/python/mypy/issues/2199
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Binder should reason about complex expressions","articleBody":"Here's a very simple example:\n\n```\nfrom typing import *\na = ['x', None] # type: List[Optional[str]]\nfor i in range(len(a)):\n if a[i]:\n print(i, '\u003c' + a[i] + '>')\n```\n\nWe get an error on the last line:\n\n```\n__tmp__.py:5: error: Unsupported operand types for + (\"str\" and \"Optional[str]\")\n```\n\nOf course I can refactor this by using\n\n```\nfor i in range(len(a)):\n ai = a[i]\n if ai:\n print(i, '\u003c' + ai + '>')\n```\n\nbut that's just busy-work and doesn't necessarily make the code more readable.\n\n(I found this in some mypy test code where the actual expression was `p[i].arg` so this probably needs to become fairly powerful.)\n","author":{"url":"https://github.com/gvanrossum","@type":"Person","name":"gvanrossum"},"datePublished":"2016-09-30T18:13:40Z","url":"https://github.com/python/mypy/issues/2199"}
| 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:662e34af-9ae9-de21-5855-2468784535c2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AAA8:9E1B2:3590448:472D0F7:6B0044BD |
| html-safe-nonce | d211706bb5d6cecf0d1db5024c62b68878e75653633a93d114ffb168b778ca28 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQUE4OjlFMUIyOjM1OTA0NDg6NDcyRDBGNzo2QjAwNDRCRCIsInZpc2l0b3JfaWQiOiIxMTk0NjA4MjgyODgzMzQzNTQ5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 57f764f495d5396509a470d311a91e53a61cd91ad9da36aef19c695d03f38435 |
| hovercard-subject-tag | issue:180368017 |
| 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/2199/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bfd893322ee8252a4eb76ef5b174b0c7f1a6daaf797194a72d7930fdee291635/python/mypy/issues/2199 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bfd893322ee8252a4eb76ef5b174b0c7f1a6daaf797194a72d7930fdee291635/python/mypy/issues/2199 |
| og:image:alt | Here's a very simple example: from typing import * a = ['x', None] # type: List[Optional[str]] for i in range(len(a)): if a[i]: print(i, '<' + a[i] + '>') We get an error on the last line: __tmp__.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gvanrossum |
| 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