Re:Attrs – the Python library everyone needs (2016)
by joshuamorton on Friday December 24, 2021 @08:50PM
(#29679568)
Echoing the other commenter, attrs is generally superior to dataclasses (dataclasses is a feature-limited std library "backport" of attrs). It will be updated less often and support less stuff. The only real reason to use dataclasses is if you want to avoid a third-party dependency, which is sometimes valid but doesn't make the more featureful version "obsolete".
[ Parent
| on HN ]
Re:Attrs – the Python library everyone needs (2016)
by dreamofkoholint on Friday December 24, 2021 @09:34PM
(#29679818)
Is there a reason those features weren't added to data classes?
I don't know much about attrs, only professionally coming to python since 3.7, but I'm not going to bring it in if there's something sufficient in the language
Re:Attrs – the Python library everyone needs (2016)
by joshuamorton on Friday December 24, 2021 @09:37PM
(#29679836)
Not really, other than they decided to keep data classes very minimal, as standard library comes with maintenance costs (you can't get rid of a feature once you add it), so they kept the strict features, since everyone uses those, and not the complex validation features.