Title: Support more than just string literals with TypedDict indexing · Issue #7867 · python/mypy · GitHub
Open Graph Title: Support more than just string literals with TypedDict indexing · Issue #7867 · python/mypy
X Title: Support more than just string literals with TypedDict indexing · Issue #7867 · python/mypy
Description: from mypy_extensions import TypedDict T = TypedDict('T', {'a': float, 'b': float, 'c': float}) foo: T = {'a': 0.0, 'b': 0.0, 'c': 0.0} for key in ('a', 'b', 'c'): foo[key] = 1.0 mypy currently (0.730) complains about that last line, sayi...
Open Graph Description: from mypy_extensions import TypedDict T = TypedDict('T', {'a': float, 'b': float, 'c': float}) foo: T = {'a': 0.0, 'b': 0.0, 'c': 0.0} for key in ('a', 'b', 'c'): foo[key] = 1.0 mypy currently (0.7...
X Description: from mypy_extensions import TypedDict T = TypedDict('T', {'a': float, 'b': float, 'c': float}) foo: T = {'a': 0.0, 'b': 0.0, 'c': 0.0} for ke...
Opengraph URL: https://github.com/python/mypy/issues/7867
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support more than just string literals with TypedDict indexing","articleBody":"```\r\nfrom mypy_extensions import TypedDict\r\n\r\nT = TypedDict('T', {'a': float, 'b': float, 'c': float})\r\n\r\nfoo: T = {'a': 0.0, 'b': 0.0, 'c': 0.0}\r\n\r\nfor key in ('a', 'b', 'c'):\r\n foo[key] = 1.0\r\n```\r\n\r\nmypy currently (0.730) complains about that last line, saying `error: TypedDict key must be a string literal; expected one of ('a', 'b', 'c')`. It's understandable, but limiting - it'd be great if mypy could recognise that `key` is in fact one of the valid keys for `T`.","author":{"url":"https://github.com/wadetregaskis-linkedin","@type":"Person","name":"wadetregaskis-linkedin"},"datePublished":"2019-11-04T18:14:54Z","url":"https://github.com/python/mypy/issues/7867"}
| 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:4961dddd-17e6-8eac-ac56-d1dfe226e45a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 966A:36D598:F11A1B:14280F8:6B005844 |
| html-safe-nonce | c45822694dfbe35664121251887cfb22e2393d417c94c7762984cfb72a3ed712 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjZBOjM2RDU5ODpGMTFBMUI6MTQyODBGODo2QjAwNTg0NCIsInZpc2l0b3JfaWQiOiI5NDI3MDg4NzE4Nzk3NDM1NTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 44dd4541a795a2017de8ef0835bd5e2205cf2ecc44ad6fc50f5a84a792849b41 |
| hovercard-subject-tag | issue:517319687 |
| 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/7867/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3590a5c54a2496aa5a420079605548162cccf729b883074ffccd6eda53fb90c3/python/mypy/issues/7867 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3590a5c54a2496aa5a420079605548162cccf729b883074ffccd6eda53fb90c3/python/mypy/issues/7867 |
| og:image:alt | from mypy_extensions import TypedDict T = TypedDict('T', {'a': float, 'b': float, 'c': float}) foo: T = {'a': 0.0, 'b': 0.0, 'c': 0.0} for key in ('a', 'b', 'c'): foo[key] = 1.0 mypy currently (0.7... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wadetregaskis-linkedin |
| 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