Message347142
Hi,
When using inheritance with dataclass, "standard" instance methods that are provided with a default behavior thanks to dataclass are not overridable using inheritance.
Please see the sample below (or the attached file):
import dataclasses
@dataclasses.dataclass
class A:
def __eq__(self, other):
return True
@dataclasses.dataclass
class B(A):
pass
print(A() == 1) # Returns True as expected
print(B() == 1) # Returns False instead of True as expected via inheritance
Thanks again |
|
Date |
User |
Action |
Args |
2019-07-02 13:44:03 | colin-b | set | recipients:
+ colin-b |
2019-07-02 13:44:03 | colin-b | set | messageid: <1562075043.32.0.192151434344.issue37485@roundup.psfhosted.org> |
2019-07-02 13:44:03 | colin-b | link | issue37485 messages |
2019-07-02 13:44:03 | colin-b | create | |
|