On 17.05.2017 13:37, Michel Desmoulin wrote:
Having a cleaner, faster solution to declare a class would be awesome, both for dev and for teaching. That's why we all love attrs.
But we are talking here about a nice-to-have feature. Python works perfectly fine without it. But since we are at it, let's make something great.
Same for me. IMHO the biggest benefit using attr is an (almost?) feature-complete and bug-free set of pre-defined __dunder__ methods as described in .
Defining state-variables (aka instance variables accessible via 'self.') wouldn't be enough for me to make it a valuable feature. So, one could imagine a __dunder__-method generator of some sort.
But even given that (and I am only speaking for my team), I haven't even seen a use-case for namedtuples in a year. Every time we considered it, people said: "please make it its own class for documentary purposes; this thing will tend to grow faster than we can imagine".
But even then, it's already an additional burden to have to explain the difference between this magic and the regular class attribute.
It might also have something to do with this. IMO this feature should integrate naturally in a way that nobody notice.