I want to use class attributes to make a single list of all attributes:
from dataclasses import dataclass
@dataclass
class Foo:
a: int
b: int
data = [
Foo(1,2),
Foo(3,4)
]
print([[foo.a, foo.b] for foo in data])
But the result is a list of lists of attributes. How can I have a single list containing all attributes [1,2,3,4] instead of [[1,2],[3,4]]?