Message381399
Another counter-intuitive behaviour is the different behaviour of dataclasses depending on whether they were defined with the decorator or the make_dataclass factory method:
from __future__ import annotations
import dataclasses
mytype = int
@dataclasses.dataclass
class MyClass1:
foo: mytype = 1
MyClass2 = dataclasses.make_dataclass(
f'MyClass2',
[('foo', mytype, 1)]
)
print(dataclasses.fields(MyClass1)[0].type)
print(dataclasses.fields(MyClass2)[0].type)
Results in:
mytype
<class 'int'> |
|
Date |
User |
Action |
Args |
2020-11-19 09:50:09 | ARF1 | set | recipients:
+ ARF1, eric.smith, drhagen, lopek |
2020-11-19 09:50:09 | ARF1 | set | messageid: <1605779409.9.0.371193021407.issue39442@roundup.psfhosted.org> |
2020-11-19 09:50:09 | ARF1 | link | issue39442 messages |
2020-11-19 09:50:09 | ARF1 | create | |
|