Title: Dataclasses should define `__replace__` in 3.13 · Issue #17471 · python/mypy · GitHub
Open Graph Title: Dataclasses should define `__replace__` in 3.13 · Issue #17471 · python/mypy
X Title: Dataclasses should define `__replace__` in 3.13 · Issue #17471 · python/mypy
Description: Feature Add __replace__ on dataclasses in 3.13+. Pitch Similar to how we're special casing support for __replace__ on namedtuple, we should do the same for dataclasses. This is causing some false positive issues in TypeShed, where __repl...
Open Graph Description: Feature Add __replace__ on dataclasses in 3.13+. Pitch Similar to how we're special casing support for __replace__ on namedtuple, we should do the same for dataclasses. This is causing some false p...
X Description: Feature Add __replace__ on dataclasses in 3.13+. Pitch Similar to how we're special casing support for __replace__ on namedtuple, we should do the same for dataclasses. This is causing some fal...
Opengraph URL: https://github.com/python/mypy/issues/17471
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dataclasses should define `__replace__` in 3.13","articleBody":"**Feature**\r\n\r\nAdd `__replace__` on dataclasses in 3.13+.\r\n\r\n**Pitch**\r\n\r\n\u003c!-- Please explain why this feature should be implemented and how it would be used. Add examples, if applicable. -->\r\n\r\nSimilar to how we're special casing support [for `__replace__` on namedtuple](https://github.com/python/mypy/pull/17259), we should do the same for dataclasses.\r\n\r\nThis is causing some false positive issues in [TypeShed](https://github.com/python/typeshed/blob/989e25043cdf1a09bada0ccfd68c9d0e4799abfb/stdlib/%40tests/stubtest_allowlists/py313.txt#L118), where `__replace__` isn't getting registered on dataclasses (`FunctionProfile` and `StatsProfile`) and is needed to properly support the protocol for `copy.replace`: https://github.com/python/typeshed/pull/12262","author":{"url":"https://github.com/max-muoto","@type":"Person","name":"max-muoto"},"datePublished":"2024-07-03T06:43:36Z","url":"https://github.com/python/mypy/issues/17471"}
| 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:635b99eb-6b12-2098-4361-8e5559ef542d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 97F8:37BEAD:243A194:316C095:6B00345C |
| html-safe-nonce | 039fa6581869176af2ae29ec919f2d9a3255c68b60734f809d165475bdedd367 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0Y4OjM3QkVBRDoyNDNBMTk0OjMxNkMwOTU6NkIwMDM0NUMiLCJ2aXNpdG9yX2lkIjoiNzYzMjc5NzI2NjQxMTAwOTExNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 333bd697fcfbb2998f4e9248be9436bbec00b508b81d093f5c474b0e0fed9199 |
| hovercard-subject-tag | issue:2387807734 |
| 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/17471/issue_layout |
| twitter:image | https://opengraph.githubassets.com/db1a0dfcd1b0b7c1819c2be93a32320f89bc9cb5b9498ed60b94b68ce1d07783/python/mypy/issues/17471 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/db1a0dfcd1b0b7c1819c2be93a32320f89bc9cb5b9498ed60b94b68ce1d07783/python/mypy/issues/17471 |
| og:image:alt | Feature Add __replace__ on dataclasses in 3.13+. Pitch Similar to how we're special casing support for __replace__ on namedtuple, we should do the same for dataclasses. This is causing some false p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | max-muoto |
| 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