Hacker News new | ask | show | jobs
by hprotagonist 2951 days ago
I am happy that lightweight data classes are now in the stdlib -- hopefully this puts an expiration date on overuse of namedtuple, which has turned out to be kind of a bad idea. Being able to make sane lightweight classes in one-off one-file python scripts will be nice.

That said, on any package that I write that has third party dependencies anyway (read: all of them), I don't see a compelling reason to change from attrs.

1 comments

You nailed it with "on any package that I write that has third party dependencies anyway". On my recent package I was going for zero dependencies (at py3.7+) so I used the backport of dataclasses.

Ultimately, I threw out dataclasses too. But if I didn't need __repr__, __post_init__ and __slots__ with default values, I'd probably have just stuck with dataclasses :)