Title: `csv.DictReader` and `DictWriter` not subscriptable at runtime · Issue #92391 · python/cpython · GitHub
Open Graph Title: `csv.DictReader` and `DictWriter` not subscriptable at runtime · Issue #92391 · python/cpython
X Title: `csv.DictReader` and `DictWriter` not subscriptable at runtime · Issue #92391 · python/cpython
Description: Feature or enhancement Add PEP 585 style __class_getitem__ to csv.DictReader and csv.DictWriter. Pitch With PEP 585 most generic stdlib types are now subscriptable at runtime. Both DictReader and DictWriter are generic in typeshed but do...
Open Graph Description: Feature or enhancement Add PEP 585 style __class_getitem__ to csv.DictReader and csv.DictWriter. Pitch With PEP 585 most generic stdlib types are now subscriptable at runtime. Both DictReader and D...
X Description: Feature or enhancement Add PEP 585 style __class_getitem__ to csv.DictReader and csv.DictWriter. Pitch With PEP 585 most generic stdlib types are now subscriptable at runtime. Both DictReader and D...
Opengraph URL: https://github.com/python/cpython/issues/92391
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`csv.DictReader` and `DictWriter` not subscriptable at runtime","articleBody":"**Feature or enhancement**\r\n\r\nAdd PEP 585 style `__class_getitem__` to `csv.DictReader` and `csv.DictWriter`.\r\n\r\n**Pitch**\r\n\r\nWith PEP 585 most generic stdlib types are now subscriptable at runtime. Both [DictReader](https://github.com/python/typeshed/blob/46fc7768c4df6f713e81a0078e72b9805679c25f/stdlib/csv.pyi#L75) and [DictWriter](https://github.com/python/typeshed/blob/46fc7768c4df6f713e81a0078e72b9805679c25f/stdlib/csv.pyi#L107) are generic in typeshed but don't yet implement `__class_getitem__`.\r\n\r\n```py\r\nfrom csv import DictWriter\r\nfrom typing import IO\r\n\r\ndef f(fp: IO[str]) -\u003e DictWriter[str]:\r\n return DictWriter(fp, [\"id\", \"name\"])\r\n```\r\n\r\n**Previous discussion**\r\n* #19423\r\n* https://mypy.readthedocs.io/en/stable/runtime_troubles.html#using-classes-that-are-generic-in-stubs-but-not-at-runtime\r\n","author":{"url":"https://github.com/cdce8p","@type":"Person","name":"cdce8p"},"datePublished":"2022-05-06T10:59:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/92391/cpython/issues/92391"}
| 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:602ba874-3b77-5f18-5b04-4f8aba6b1cbe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D214:1860A8:1A68C37:245DDD1:696AA48E |
| html-safe-nonce | 32a24ea521ed10b2bb7104515af128b856d10a02bcf31b118c8acc2b5a839d26 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjE0OjE4NjBBODoxQTY4QzM3OjI0NURERDE6Njk2QUE0OEUiLCJ2aXNpdG9yX2lkIjoiODcyNjEwMjc1NjYxMjAyMzQzOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | eb5cab2aed73fa63704be9fe4e0fdcb37c15592e0acec7902051debbc2c55f41 |
| hovercard-subject-tag | issue:1227715158 |
| 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/cpython/92391/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ae5ac06db839c8a4b0d2efd335de56cda1e26ebfeebcf92448d9be67fd0404b1/python/cpython/issues/92391 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ae5ac06db839c8a4b0d2efd335de56cda1e26ebfeebcf92448d9be67fd0404b1/python/cpython/issues/92391 |
| og:image:alt | Feature or enhancement Add PEP 585 style __class_getitem__ to csv.DictReader and csv.DictWriter. Pitch With PEP 585 most generic stdlib types are now subscriptable at runtime. Both DictReader and D... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cdce8p |
| hostname | github.com |
| expected-hostname | github.com |
| None | a51f97dbb9326f71c08ecb61577457d543c602124d1a2672871258ef37ac5261 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 4bd0eac606c70914085176ef312ebdcd97a8cdf1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width