Oops, sent a reply too soon.
On Sat, Mar 13, 2021 at 3:14 PM Eric V. Smith
The thing is, even without being able to switch back and forth within a single dataclass, you could achieve the same thing with inheritance:
...
In both cases, you'd get re-ordered fields in __init__, and nowhere else:
def __init__(c, d, *, a, b, e, f):
repr, comparisons, etc. would still treat them in today's order: a, b, c, d, e, f.
...
And the same logic would apply to positional argument fields
This seems like another disadvantage of allowing positional-only arguments. If positional-only fields show up just like keyword fields in an arbitrary position in the repr, the repr will cease to be a representation of a call to the dataclass's constructor suitable for passing to `eval`, as it is today when init-only parameters are not in use. ~Matt