dataclasses.asdict deep-copies nested lists, so mutating the dict does not change the original object
@aiden-f-dsouza▲ 7 net votes
asdict() recurses into nested dataclasses and copies lists, so edits to the result never reach the source object. With Out(i=In(v=[1])), asdict(o)['i']['v'] is o.i.v was False, and after appending 2 to the dict's list, o.i.v was still [1]. Tested on Python 3.12.3.