Title: Rename dataclass's __replace__ argument from "obj" to "self"? · Issue #114198 · python/cpython · GitHub
Open Graph Title: Rename dataclass's __replace__ argument from "obj" to "self"? · Issue #114198 · python/cpython
X Title: Rename dataclass's __replace__ argument from "obj" to "self"? · Issue #114198 · python/cpython
Description: Bug report Bug description: The first argument of the new __replace__ method on dataclasses is conspicuously named obj rather than self. While that's not a bug, it would be kinder on introspection tools to use self, since it is otherwise...
Open Graph Description: Bug report Bug description: The first argument of the new __replace__ method on dataclasses is conspicuously named obj rather than self. While that's not a bug, it would be kinder on introspection ...
X Description: Bug report Bug description: The first argument of the new __replace__ method on dataclasses is conspicuously named obj rather than self. While that's not a bug, it would be kinder on introspect...
Opengraph URL: https://github.com/python/cpython/issues/114198
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Rename dataclass's __replace__ argument from \"obj\" to \"self\"?","articleBody":"# Bug report\n\n### Bug description:\n\nThe first argument of the new `__replace__` method on dataclasses is conspicuously named `obj` rather than `self`. While that's not a bug, it would be kinder on introspection tools to use `self`, since it is otherwise a regular instance method.\n\n```python\n>>> import dataclasses, inspect, pprint\n>>> @dataclasses.dataclass\n... class Foo:\n... x: int\n... \n>>> pprint.pprint({n:inspect.signature(f) for n, f in inspect.getmembers(Foo, inspect.isfunction)})\n{'__eq__': \u003cSignature (self, other)>,\n '__init__': \u003cSignature (self, x: int) -> None>,\n '__replace__': \u003cSignature (obj, /, **changes)>,\n '__repr__': \u003cSignature (self)>}\n```\n\n`__replace__` was added in #108752 \n\n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-114251\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/pschanely","@type":"Person","name":"pschanely"},"datePublished":"2024-01-17T18:06:34Z","url":"https://github.com/python/cpython/issues/114198"}
| 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:558e66b0-4c5a-4a1f-46d9-35ec3217f199 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 85F6:2A087:D1014C:118712D:6B00546E |
| html-safe-nonce | 432d654b07a86187740ad2ac1427429751ea40fde5ad47ac36a794d9b6d51bff |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NUY2OjJBMDg3OkQxMDE0QzoxMTg3MTJEOjZCMDA1NDZFIiwidmlzaXRvcl9pZCI6IjUyMjIzNzYxMTEzOTE5MjEyNjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 26136e71beb803e943e28a1a1f06bbd61ffef46add578b451289b48c2bddbb18 |
| hovercard-subject-tag | issue:2086710404 |
| 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/114198/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ba9148b1f94763e734c9f164f6672695baa4aa429896a641e433e7a41a8edeff/python/cpython/issues/114198 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ba9148b1f94763e734c9f164f6672695baa4aa429896a641e433e7a41a8edeff/python/cpython/issues/114198 |
| og:image:alt | Bug report Bug description: The first argument of the new __replace__ method on dataclasses is conspicuously named obj rather than self. While that's not a bug, it would be kinder on introspection ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pschanely |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width