(Where’s the broken heart emoji reaction?)
Thanks for the response, and especially the explanation. Although it’s a bummer, I think the answer is very fair and understandable.
I hope others do chime on on their specific use-case, especially since the ones that said they’d benefit already have chosen standard library dataclass
es over attrs
despite not having this feature (even though that means more hurdles and pain). I’ll chime in on ours (I don’t remember if I have already) in a separate comment.
They can already use third party dataclass-like libraries (presumably
attrs
) providing the feature today instead of waiting for CPython 3.13+.
I’ll say that since this PEP augments dataclass_transform
, I don’t think the choice is binary. On the project that motivated this PEP we’d likely define a dataclass transform that simply handles conversion semantics and then forwards to dataclass
, with the expectation that once we upgrade to Python 3.13 we’ll replace usage of the decorator with dataclass
. The ability to do so lies in the fact that type-checkers support typing_extensions
backports This was intentional on my part (maybe I should’ve made it explicit on the PEP?)
And speaking of type-checking…
One gap this decision remains open and unsolved is the type-semantics of any dataclass transform providing conversion semantics. This escapade started off as a question of augmenting dataclass_transform
to support this feature. Since type-checkers, without special-casing, don’t support attrs
’s conversion semantics when defined as a dataclass_transform
, it seems to me that if the answer to this PEP is “you should probably just use attrs
”, that we ought to plug the gap. Otherwise, we didn’t push the needle on any of the problems outlined in the “Motivation” section and told the community to use a sub-optimal solution.
So, can I ask for a gut-feel strawman from the (current) Steering Council on, if this PEP is likely to be rejected, a similar PEP scoped just to dataclass_transform
?
(Regardless, saying “no” isn’t fun, but can certainly be necessary. I’m just glad the community is the way it is, from the strangers on these threads all the way up to the big bad Steering Council . Thanks for considering the PEP)