Is your feature request related to a problem? Please describe.
import dataclasses
@dataclasses.dataclass
class Bar:
x: int = dataclasses.field()
bar = Bar(1)
dataclasses.replace(bar, x='') # maybe should error?
Describe the solution you'd like
Ideally, a type error on the last line 😄
I understand it'd require special-casing dataclasses.replace, but I think the pros outweigh the cons.
(maybe https://discuss.python.org/t/generalize-replace-function/28511/14 would also help here?)
Additional context
I was testing if the provisional PEP 712 support did the right thing and found this. When/if this is fixed, mind checking on PEP 712 support? 😄
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Ideally, a type error on the last line 😄
I understand it'd require special-casing
dataclasses.replace, but I think the pros outweigh the cons.(maybe https://discuss.python.org/t/generalize-replace-function/28511/14 would also help here?)
Additional context
I was testing if the provisional PEP 712 support did the right thing and found this. When/if this is fixed, mind checking on PEP 712 support? 😄