Re:Use keyword-only arguments in Python dataclasses
by ziml77 on Monday June 30, 2025 @10:26AM
(#44423738)
But the problem here is that with a dataclass you never explicitly defined any parameters. It's the dataclass annotation that defined them for the constructor based on the order of the fields. So, yes the solution is to never re-order the fields and only add new ones to the end, but this can be a surprising requirement because normally the order of fields in a class doesn't matter to users of the class.
[ Parent
| on HN ]
There are no comments on this comment yet.