Message413553
> I'm not crazy about adding a method to every dataclass just for the 0.1% of the times it's needed.
I'm not sure I totally understand the cost here. You can have a single shared global function that you set on each dataclass. So the only cost would be an entry in each dataclass type's dict. Even if a user creates a thousand dataclasses, that should only be tens of killobytes in pointers.
> I think using hasattr or catching the exception is a better way to go.
If you choose this, then I think this should be documented under the __post_init__ saying that any time you define __post_init__, you should either be a final class, or else call super. If you call super, you musteither use hasattr(super().__post_init__) or catch the exception.
I have to admit, I find this quite ugly from a user perspective. |
|
Date |
User |
Action |
Args |
2022-02-19 17:13:14 | NeilGirdhar | set | recipients:
+ NeilGirdhar, eric.smith, veky, sobolevn |
2022-02-19 17:13:14 | NeilGirdhar | set | messageid: <1645290794.49.0.0234345786799.issue46757@roundup.psfhosted.org> |
2022-02-19 17:13:14 | NeilGirdhar | link | issue46757 messages |
2022-02-19 17:13:14 | NeilGirdhar | create | |
|