Update __dataclass_params__ to track actual changes made by decorator
@ericvsmith 已经在做这个了。
开始于 2022年11月23日。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Several of the options available via the dataclass decorator, such as repr, hash, and eq, are ignored if the corresponding methods are already in the class being decorated; however, they still have their default value of True. This makes it difficult, if not impossible, to discern whether a dataclass' special method was given by dataclass or if the user wrote it.
As an example of the introspection concern, Enum uses __dataclass_params__.repr to decide if it should use a dataclass-specific repr, or use the dataclass' repr. Without this enhancement, the user has to both specify @dataclass(repr=False) and include their new __repr__ method, instead of just including the new __repr__ and having dataclass automatically set __dataclass_params__.repr to False.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。