questions about CheckedDict and unknown types
还没有人认领这个 Issue。
评估
调研方向
首先,使用所引用的 static Python 提交复现 issue 中的两个示例,并对比 issue 59 中描述的预期行为。跟踪注解和 CheckedDict 构造函数调用对未知泛型类型的处理。完成标准是两种形式都被接受,并且构造函数结果与 CheckedDict[str, object] 兼容。
由索引模型根据 Issue 内容生成。
描述
IIUC (based on issue 59), types like CheckedDict[str, Set[str]] where SP doesn't understand part of the type should:
- be allowed, and
- turn into
CheckedDict[str, object]
But neither seems to work. (I'm running SP commit 1b01cd886.)
First, this type doesn't work except in a constructor call. Other type annotations give an error:
from __static__ import CheckedDict
from typing import Set
def f(dd: CheckedDict[int, Set[str]]):
return
# def f(dd: CheckedDict[int, Set[str]]):
# TypeError: expected type or Optional[T] for generic argument
Second, the constructor call gives a chkdict[str, dynamic] instead of replacing the unknown type with object:
from __static__ import CheckedDict
from typing import Set
d0: CheckedDict[str, dynamic] = CheckedDict[str, Set[str]]({})
# OK
d1: CheckedDict[str, object] = CheckedDict[str, Set[str]]({})
# compiler.errors.TypedSyntaxError: type mismatch: chkdict[str, dynamic] cannot be assigned to chkdict[str, object]
Are these problems?
- 主要语言
- Python
- 星标
- 3.8k
- 派生
- 139
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
facebookincubator/MetaPython 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
facebookincubator/MetaPython#147 ·
-
难度 4/5 3-5 天 新手友好度 45/100
facebookincubator/MetaPython#146 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
facebookincubator/MetaPython#145 · 4 条评论 ·
-
难度 3/5 1-2 天 新手友好度 30/100
facebookincubator/MetaPython#144 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 20/100
facebookincubator/MetaPython#129 · 2 条评论 ·
查看 facebookincubator/MetaPython 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
ClickHouse/clickhouse-connect#1057 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 70/100
open-telemetry/sig-end-user#406 ·
-
bug ci good first issue
难度 2/5 1-3 小时 新手友好度 88/100