Title: asdict use deep copy to dataclass instances
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8, Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Itayazolay, avrahami.ben, eric.smith
Priority: normal Keywords:

Created on 2021-07-21 11:29 by Itayazolay, last changed 2021-07-21 19:09 by Itayazolay.

Messages (1)
msg397938 - (view) Author: Itay azolay (Itayazolay) * Date: 2021-07-21 11:29
I noticed that 'asdict' use 'deepcopy' on all fields of the dataclass recursively. 
I believe this behavior can become optional with an argument, and shouldn't be decided for the user as the deepcopy takes significant amount of cpu and can have unexpected consequences on memory.

I don't mind taking this PR if you agree. 
Date User Action Args
2021-07-21 19:09:02Itayazolaysetversions: + Python 3.10, Python 3.11, - Python 3.6
2021-07-21 18:38:42avrahami.bensetnosy: + avrahami.ben
2021-07-21 11:39:14xtreaksetnosy: + eric.smith
2021-07-21 11:29:22Itayazolaycreate