Thanks for the article, I completely agree. For myself, even on very small projects, the benefits of using an explicit class make themselves apparent very quickly. My rule of thumb is that if I know ahead of time what all the keys are, it shouldn't be a dictionary, it should be a class.
With good tools for quickly defining classes, there is no reason not to any more. I tend to use attrs library instead of the standard library dataclass, but it works very similarly, especially if you use auto_attribs=True.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the article, I completely agree. For myself, even on very small projects, the benefits of using an explicit class make themselves apparent very quickly. My rule of thumb is that if I know ahead of time what all the keys are, it shouldn't be a dictionary, it should be a class.
With good tools for quickly defining classes, there is no reason not to any more. I tend to use
attrs
library instead of the standard library dataclass, but it works very similarly, especially if you useauto_attribs=True
.