3 ms·
> I wish python had a clean way to define types without defining classes dataclasses are pretty much that. They use the class mechanism but they're culturally
by simonw 1y ago
> I wish python had a clean way to define types without defining classes
dataclasses are pretty much that. They use the class mechanism but they're culturally accepted now as a clean way to build the equivalent of structs.
- paulddraper 1y ago^ Agreed. And e.g. you can add dataclasses-json for JSON serializability: https://pypi.org/project/dataclasses-json/ https://pypi.org/project/dataclasses-json/
- isjustintime 1y agoYes, dataclasses are great. I often use them as a pretty clear and adopted way to handle serialization and deserialization, configs, etc.