Message398118
@Arjun - this is about default values (See the bug description - Using a frozendict as a default value)
Try this:
from frozendict import frozendict
from dataclasses import dataclass
@dataclass
class A:
a: frozendict = frozendict(a=1)
This used to work until frozendict became a subclass of dict.
Perhaps another fix is to convert any dict to a frozendict? Maybe not.
How would you handle this case? The only thing I figured was:
from frozendict import frozendict, field
from dataclasses import dataclass
AD=frozendict(a=1)
@dataclass
class A:
a: frozendict = field(default_factory=lambda:AD)
Which imho is cumbersome. |
|
Date |
User |
Action |
Args |
2021-07-24 06:45:59 | gianni | set | recipients:
+ gianni, eric.smith, CCLDArjun |
2021-07-24 06:45:59 | gianni | set | messageid: <1627109159.36.0.509582449495.issue44674@roundup.psfhosted.org> |
2021-07-24 06:45:59 | gianni | link | issue44674 messages |
2021-07-24 06:45:59 | gianni | create | |
|