Title: Consider allowing frozendicts to be assigned to instance dicts · Issue #145119 · python/cpython · GitHub
Open Graph Title: Consider allowing frozendicts to be assigned to instance dicts · Issue #145119 · python/cpython
X Title: Consider allowing frozendicts to be assigned to instance dicts · Issue #145119 · python/cpython
Description: Currently, can make an assignment to an instance's __dict__ attribute but the value must be an actual dict. It should allow frozendict as well. This would be useful for making immutable instances without the awkward work arounds used in ...
Open Graph Description: Currently, can make an assignment to an instance's __dict__ attribute but the value must be an actual dict. It should allow frozendict as well. This would be useful for making immutable instances w...
X Description: Currently, can make an assignment to an instance's __dict__ attribute but the value must be an actual dict. It should allow frozendict as well. This would be useful for making immutable instanc...
Opengraph URL: https://github.com/python/cpython/issues/145119
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Consider allowing frozendicts to be assigned to instance dicts","articleBody":"Currently, can make an assignment to an instance's `__dict__` attribute but the value must be an actual dict. It should allow `frozendict` as well. \n\nThis would be useful for making immutable instances without the awkward work arounds used in frozen dataclasses.\n\n```python\n\u003e\u003e\u003e class Point:\n... def __init__(self, x, y):\n... self.__dict__ = frozendict(x=x, y=y)\n...\n \n\u003e\u003e\u003e p = Point(10, 20)\nTraceback (most recent call last):\n File \"\u003cpyshell#53\u003e\", line 1, in \u003cmodule\u003e\n p = Point(10, 20)\n File \"\u003cpyshell#52\u003e\", line 3, in __init__\n self.__dict__ = frozendict(x=x, y=y)\nTypeError: __dict__ must be set to a dictionary, not a 'frozendict'\n```\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-145123\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/rhettinger","@type":"Person","name":"rhettinger"},"datePublished":"2026-02-22T15:56:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/145119/cpython/issues/145119"}
| 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:c7100e9c-be80-4140-16ff-82d297cdfadf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E134:381ACD:268F552:350678C:6A504770 |
| html-safe-nonce | e1f7ce4e3cd12e9fe29cb1032c2b0b83b43978121cc3b980c3997cd5c692563b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTM0OjM4MUFDRDoyNjhGNTUyOjM1MDY3OEM6NkE1MDQ3NzAiLCJ2aXNpdG9yX2lkIjoiOTA3MzI5Mzg5ODM1NzQyNjAzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 191bfe5e441b04c9da766ca3d77f0a516c34968c6563d070aea09c8a013ddda8 |
| hovercard-subject-tag | issue:3974880295 |
| 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/145119/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b6071211827572b2067431e4741ba073d2723e2c0fc770b84777c7eb2b0c6647/python/cpython/issues/145119 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b6071211827572b2067431e4741ba073d2723e2c0fc770b84777c7eb2b0c6647/python/cpython/issues/145119 |
| og:image:alt | Currently, can make an assignment to an instance's __dict__ attribute but the value must be an actual dict. It should allow frozendict as well. This would be useful for making immutable instances w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rhettinger |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| 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 | 5741a45fe07e5f377d0d4c524a92e3056acc51bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width