Discrepancy between spec and tests on indexing TypedDicts with non-literal variables
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.8k
- 派生
- 302
- 平均合并
- 23 小时
- 30 天内合并 PR
- 8
描述
Splitting issue from PR https://github.com/python/typing/pull/1978
Spec says that it should be generally rejected (ref)
A key that is not a literal should generally be rejected, since its value is unknown during type checking, and thus can cause some of the above violations.
But currently conformance tests do not reflect it.
So in theory to resolve this, either strictness should be reflected in conformance tests or spec should be amended allowing optional enforcement.
Related discussion - https://discuss.python.org/t/indexing-typeddict-with-a-non-literal-variable/88929
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先从 TypedDict 操作规范部分以及第 34-38 行附近的 conformance/tests/typeddicts_operations.py 开始,然后阅读 PR 1978 和链接的讨论。确定一致性测试是否应拒绝非字面量索引,或者规范是否应允许可选强制执行。规范和一致性测试一致地描述约定的行为,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- documentation, testing
- Issue 类型
- 文档
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100