Hi James,
Thanks for your feedback and sorry for the delayed response.
I wasn't familiar with __init_subclass__, but I experimented with it and you are correct that it can be used to create dataclass-like subclasses.
Eric Traut pointed out to me that this introduces the possibility of a class being deriving from multiple dataclass_transform classes (or a class and a metaclass). We could disallow that. But given that we're not aware of any existing dataclass libraries that use __init_subclass__, it may not be worth the extra complexity.
Does anyone have any opinions on whether this should be supported or not?
-Erik
-----Original Message-----
From: James H-B
Sent: Monday, December 13, 2021 2:13 PM
To: typing-sig@python.org
Subject: [Typing-sig] Re: Dataclass Transform draft PEP
[You don't often get email from gobot1234yt@gmail.com. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
I know this isn't a common use case but why does the transformer not work on regular classes? With the added support for __init_subclass__ and __set_name__ I see no reason why someone shouldn't be able to make a dataclass-like class without the need for a metaclass.
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.pytho...
Member address: erikd@microsoft.com