What I like about attrs is:
- The class level declaration of instance attributes
- That the reasonable init, repr, and eq are generated
I don’t like the excessive wordiness in attrs,
and I don’t need “the kitchen sink” be available to have instance attributes declared at the class level. A solution based on the
typing
module would be much better.
Basically, Python is lacking a way to declare instance fields with default values away of the initializer. Several of the mainstream OO languages (Java, Swift, Go) provide for that.
I haven’t thought much about this, except about if there’s indeed a need (and there is), but I can’t know if the solution if through decorators, or inheritance.