Title: Refactor NamedTuple to put it in a stub · Issue #3102 · python/mypy · GitHub
Open Graph Title: Refactor NamedTuple to put it in a stub · Issue #3102 · python/mypy
X Title: Refactor NamedTuple to put it in a stub · Issue #3102 · python/mypy
Description: Based on @elazarg comment on gitter: I believe that instead of hard-coding behavior for NamedTuple and other constructs, we should make the building blocks needed to put them in a stub file. For NamedTuple we need a class that is paramet...
Open Graph Description: Based on @elazarg comment on gitter: I believe that instead of hard-coding behavior for NamedTuple and other constructs, we should make the building blocks needed to put them in a stub file. For Na...
X Description: Based on @elazarg comment on gitter: I believe that instead of hard-coding behavior for NamedTuple and other constructs, we should make the building blocks needed to put them in a stub file. For Na...
Opengraph URL: https://github.com/python/mypy/issues/3102
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Refactor NamedTuple to put it in a stub","articleBody":"Based on @elazarg comment on gitter:\r\n\r\n> I believe that instead of hard-coding behavior for `NamedTuple` and other constructs, we should make the building blocks needed to put them in a stub file. For `NamedTuple` we need a class that is parametrized with `TypedDict`, and maybe some magical \"*Attributes\" parameter, or maybe something else. A metaclass can replace some of the methods we've hard-coded. Perhaps we'll still need special treatment inside mypy, but we won't have problems with other mechanisms such as generic types. And the handling inside mypy won't require 100+LOC like it does today.\r\n\r\nThis was in response to my question about how to make `NamedTuple` support generics (~~#2875~~, #685, #1682).\r\n\r\nI can try to do that, but wanted to get feedback first.\r\n\r\nAlso, @JelleZijlstra:\r\n\r\n> there's currently code in `visit_class_def` in `semanal.py` that treats normal classes and namedtuples in a similar but not quite identical way (I have a pending #3081 that changes it further). it's possible that just changing that code would make generic namedtuples work, but I haven't tried","author":{"url":"https://github.com/pkch","@type":"Person","name":"pkch"},"datePublished":"2017-04-01T02:10:09Z","url":"https://github.com/python/mypy/issues/3102"}
| 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:173e0d52-0909-2662-56c6-21bbd6be2ce4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA9C:115983:270D69:348651:6B0023FE |
| html-safe-nonce | 0700538e1d8d849e1778e8b32de50ac455b79bcdb2a7b8ca77ad8bcd4cfff40e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTlDOjExNTk4MzoyNzBENjk6MzQ4NjUxOjZCMDAyM0ZFIiwidmlzaXRvcl9pZCI6IjQwNjQ4MjMwMjE0MjcyMzc4ODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 66b80e6fba4386964ecb84d44f533ad342ef062f77352a190af75c588a485a95 |
| hovercard-subject-tag | issue:218659333 |
| 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/3102/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2634f307ad8d1ebb1ea9518302114c0eea6e0fcac6828b2c8e5cc952039510a9/python/mypy/issues/3102 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2634f307ad8d1ebb1ea9518302114c0eea6e0fcac6828b2c8e5cc952039510a9/python/mypy/issues/3102 |
| og:image:alt | Based on @elazarg comment on gitter: I believe that instead of hard-coding behavior for NamedTuple and other constructs, we should make the building blocks needed to put them in a stub file. For Na... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pkch |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width