I am working with a dataclass that contains a dict.
I want the dict to be a deepcopy, without having to rely on a post_init call, which would basically void to interest of a dataclass
What would be a nice solution ?
from dataclasses import dataclass, field
from typing import Dict
@dataclass
class ClassWithDict:
the_dict: Dict = field(default_factory=dict, kw_only=True)
toto = {"toto": "tata"}
the_class = ClassWithDict(the_dict=toto)
assert toto == the_class.the_dict
assert toto is not the_class.the_dict # FALSE