Re:Using attrs for everything in Python
by jgalt212 on Thursday August 25, 2016 @02:04PM
(#12361098)
In that case, I'd just deal with the overhead of a normal class. More boilerplate, of course, but I'd have more control over the class.
As to the use cases, I was not really buying into them other than the nice destructuring example, which is actually very nice one.
I think the point is that this is basically a normal class, but one with the boilerplate already written for you. If you don't mind boilerplate, this library does nothing for you. If you don't want to write classes and think dicts are good enough, this library does nothing for you.
If you do want to have classes but don't want the boilerplate that comes with making a basic-but-full-featured class, then that's where this library comes in.
When you say use a dictionary, do you mean subclass `dict`? One of the aims of the project is to constrain the available instance attributes, as in a normal class. How would your dict proposal do that?