Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I feel like "consider dataclasses as a useful default" is decent advice.

I agree.

> You get the stuff you get from `NamedTuple`, but you can also easily add helper methods to the class as needed. And there are other dataclass goodies (though some things I find to be a bit anti-feature-y).

I've seen examples where dataclasses were used when order matters, however, hence why I'm not comfortable with a general rule against namedtuples. Sometimes order and iterability matter, and dogmatically reaching for a different data type that doesn't preserve that information might be the wrong choice.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: