On 3/11/2021 10:23 AM, Ricky Teachey wrote:
On Thu, Mar 11, 2021 at 10:20 AM Paul Bryan <pbr...@anode.ca <mailto:pbr...@anode.ca>> 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.

    Paul


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:

dataclass Point:
  x: int
  y: int

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.

Eric

<<attachment: eric.vcf>>

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/K2SXT7MKWWPPZEKTRTGKYYLGI5ZQYBJC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to