Title: Proper way to use dynamic keys for TypedDict · Issue #9168 · python/mypy · GitHub
Open Graph Title: Proper way to use dynamic keys for TypedDict · Issue #9168 · python/mypy
X Title: Proper way to use dynamic keys for TypedDict · Issue #9168 · python/mypy
Description: Is there a way to use dynamic keys for a TypedDict which is properly typed? I have code like this: if name in ['visible', 'value', 'locked']: obj[name] = self.use_var_expr(scope, value) Where obj is a TypedDict that has the same type for...
Open Graph Description: Is there a way to use dynamic keys for a TypedDict which is properly typed? I have code like this: if name in ['visible', 'value', 'locked']: obj[name] = self.use_var_expr(scope, value) Where obj i...
X Description: Is there a way to use dynamic keys for a TypedDict which is properly typed? I have code like this: if name in ['visible', 'value', 'locked']: obj[name] = self.use_var_expr(s...
Opengraph URL: https://github.com/python/mypy/issues/9168
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Proper way to use dynamic keys for TypedDict","articleBody":"Is there a way to use dynamic keys for a TypedDict which is properly typed? I have code like this:\r\n\r\n````\r\nif name in ['visible', 'value', 'locked']:\r\n\tobj[name] = self.use_var_expr(scope, value)\r\n````\r\n\r\nWhere `obj` is a `TypedDict` that has the same type for the keys 'visible', 'value', 'locked'.\r\n\r\nI know that `name` is not a literal string, but it's been verified to belong to a set of literal strings that belong to the TypedDict.\r\n\r\n","author":{"url":"https://github.com/mortoray","@type":"Person","name":"mortoray"},"datePublished":"2020-07-18T05:38:41Z","url":"https://github.com/python/mypy/issues/9168"}
| 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:d451b8b2-2261-4c94-7a37-4f07e0779a80 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFA6:36E11A:7933B:AB71F:6B004EBE |
| html-safe-nonce | 6247768ccd5e7fb015e8d84b4862c8ad263266d27894226ad723183ac8374313 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkE2OjM2RTExQTo3OTMzQjpBQjcxRjo2QjAwNEVCRSIsInZpc2l0b3JfaWQiOiI4MTYwMjQ0OTgxNTA4ODg2MjA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 747de9de798337cbfbfead3688f44c5a023de63b8ec05f2c699543d5cac4ddf0 |
| hovercard-subject-tag | issue:659924067 |
| 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/9168/issue_layout |
| twitter:image | https://opengraph.githubassets.com/80c785a7dbeb70a400a799911beb7e9f8d6f9147c01332ebbe1d8437a0a66ac4/python/mypy/issues/9168 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/80c785a7dbeb70a400a799911beb7e9f8d6f9147c01332ebbe1d8437a0a66ac4/python/mypy/issues/9168 |
| og:image:alt | Is there a way to use dynamic keys for a TypedDict which is properly typed? I have code like this: if name in ['visible', 'value', 'locked']: obj[name] = self.use_var_expr(scope, value) Where obj i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mortoray |
| 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