On Thu, Mar 11, 2021 at 10:20 AM Paul Bryan <email@example.com> wrote:
Given that @dataclass is a decorator, and otherwise you're just defining a class, some concerns:
1. Such proposed syntax would require a change to the language specification.
2. It would seem that / and * in a class not decorated with @dataclass would be of no other utility.
Well the utility of this, without dataclasses, or only for the type checker as far as I know:
class C:member: Any
Perhaps the additional syntax could also be useful for the type checker?
Type checkers certainly have to be aware of the generated __init__, so they're definitely involved.
As long as we're going all "pie in the sky", I'd like to see dataclasses baked in to the interpreter. Something like:
That's actually a typo I make all the time!
But I don't think there's really any chance of doing anything
requiring changes to the interpreter. So we're back to either
using field() or my marker types. Any other ideas that could be
implemented today? I don't think the "with" suggestion could be
made to work, but maybe I lack imagination.