4 ms·
> I think there are many reasons to want to continue having non-dataclass classes. Even just one would help us evaluation your claim! > Dataclass fits best w
by TomSwirly 4y ago
> I think there are many reasons to want to continue having non-dataclass classes.
Even just one would help us evaluation your claim!
> Dataclass fits best with record-type data and not with encapsulated data or classes with mostly private attributes.
How does it "not fit"? How would you know if a class were a datalclass? Would it break something?
For me, not having to write a constructor is a small win right away, having the class have a useful `str` representation is nice, automatically comparable and hashable are nice, I can also make immutable classes which is very nice, etc, etc.
Unless you really have no constructors of visible members, what's the drawback?
I don't use `dataclasses` everywhere but more and more when I start any class I make it a `dataclass`.