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 frozen dataclasses.
>>> class Point:
... def __init__(self, x, y):
... self.__dict__ = frozendict(x=x, y=y)
...
>>> p = Point(10, 20)
Traceback (most recent call last):
File "<pyshell#53>", line 1, in <module>
p = Point(10, 20)
File "<pyshell#52>", line 3, in __init__
self.__dict__ = frozendict(x=x, y=y)
TypeError: __dict__ must be set to a dictionary, not a 'frozendict'
Linked PRs