Message390680
> init=False is used to make sure there's no __init__ defined, because there's a difference between a class with an __init__ and one without. If there was a difference between __match_args__ being not present and __match_args__=(), then I'd support a matchargs=False argument.
Ah, I see now how this might possibly be useful.
If you want to inherit a parent's __match_args__ in a dataclass, it currently must be as spelled something like:
@dataclass
class Child(Parent):
__match_args__ = Parent.__match_args__
...
It's even uglier when you're unsure if Parent defines __match_args__ at all, or if multiple-inheritance is involved:
@dataclass
class Child(Parent, Mixin):
__match_args__ = ()
...
del Child.__match_args__
I'm not sure how likely it is that code out in the wild may need to look like this. As I understand it, though, the fact that dataclasses allow for "normal" inheritance is one of their big selling-points. So it could be a valid reason to include this option.
If it seems like the above code might become reasonably common, I agree that the proposed solution is much cleaner:
@dataclass(match_args=False)
class Child(Parent):
... |
|
Date |
User |
Action |
Args |
2021-04-09 23:55:19 | brandtbucher | set | recipients:
+ brandtbucher, gvanrossum, eric.smith, freundTech |
2021-04-09 23:55:19 | brandtbucher | set | messageid: <1618012519.83.0.360100556398.issue43764@roundup.psfhosted.org> |
2021-04-09 23:55:19 | brandtbucher | link | issue43764 messages |
2021-04-09 23:55:19 | brandtbucher | create | |
|