3 ms·
@dataclass is one of those ones where it depends on how you look at it. To me, it's a great application of "explicit is better than implicit." Because @datacla
by mumblemumble 6y ago
@dataclass is one of those ones where it depends on how you look at it.
To me, it's a great application of "explicit is better than implicit." Because @dataclass explicitly indicates that this class has a certain set of behavior, and is meant to be used a certain way. If you manually implement exactly the same behavior, you've made the individual statements more explicit, but you've made the class's actual function implicit. A reader needs to figure it out by reading the code and working backward from there. An editor of the code needs to recognize the intended behavior and not break it, otherwise the understanding that other people built up by reading the code may break in subtle ways.