Re:Attrs – the Python library everyone needs (2016)
by nsonha on Friday December 24, 2021 @05:31PM
(#29678402)
looks like the key thing is immutability
Re:Attrs – the Python library everyone needs (2016)
by aix1 on Friday December 24, 2021 @05:36PM
(#29678440)
To clarify, both named tuples and dataclasses can be immutable (the former are always immutable and the latter can be made immutable with `frozen=True`).
There is no way, however, to make a named tuple mutable.
Re:Attrs – the Python library everyone needs (2016)
by dreamofkoholint on Friday December 24, 2021 @09:43PM
(#29679874)
Key thing for me was the ability to add type hinting
Their differences are highlighted in the dataclasses PEP: https://www.python.org/dev/peps/pep-0557/#why-not-just-use-n...