|
|
|
|
|
by justanotherbody
712 days ago
|
|
It's interesting to me that dataclasses seemed to be a slimmed down attrs but in practice I find it replaces namedtuple not attrs For my use the key is how easily you can add simple conversion of values to attrs. IIRC this was intentionally omitted from dataclasses. For a 1-off using a factory with a dataclass is easy but repeated uses send me back to attrs |
|
Most people don't need, say, a[-3] as an alias for a.field_name.
Otherwise, for those who want the standard library, use a dataclass with frozen=True for immutability.