I want to use the new @dataclass decorator in my code with attribut as mutable list Something that would look like this
from dataclasses import dataclass
@dataclass
class Metrics
accuracy: list = []
loss: list = []
...
def do_stuff(data):
m = Metrics()
for i in range(0, 10):
m.accuracy.append(accuracy_def(i))
m.loss.append(loss_def(i))
return m
But I have this error:
TypeError: __init__() missing 2 required positional arguments: 'accuracy' and 'loss'