Hacker News new | ask | show | jobs
by designed 590 days ago
An advantage of dataclasses over dicts is that you can add methods and properties.

Also you can easily convert a dataclass to a dict with dataclasses.asdict. Not so easy to go from dict to dataclass though

1 comments

That's what a class is for.
Right but that's @dataclass. Being a replacement for classes in commonly used situations is one of its design goals.