Why can't dataclasses have mutable defaults in their class attributes declaration?
场景还原最近开发遇到一个问题是在python3.7的dataclass中不能使用可变的默认值,错误如下:@dataclassclassFoo:bar:list=[]#ValueError:mutabledefaultforfieldaisnotallowed:usedefault_factory收到这种错误之后,修改为如下即可:fromdataclassesimport(dataclass,fie