DEV Community

Discussion on: Dataclasses in Python are nice!

Collapse
 
gamma2653 profile image
Christopher De Jesus

Hi, I revisited this now, it seems the primary difference is dataclasses are mutable, while namedtuples are immutable. Aside from that, using dictionaries can work, but has roughly similar overhead to dataclasses; or at least the difference is negligible. It really comes down to whether you would want the ability to traverse all values/ have specific named attributes. Thanks for this article! ^_^

Thread Thread
 
isabelcmdcosta profile image
Isabel Costa

Awesome Christopher! It makes much sense now, why this exists :)
Thank you so much for coming back and sharing your knowledge!
I just learned something new with this 🤗