相关疑难解决方法(0)

Python 3.9 和 PEP 585 中的typing.Any - 标准集合中的类型提示泛型

我想了解是否typing仍然需要该软件包?

如果在 Python 3.8 中我这样做:

from typing import Any, Dict
my_dict = Dict[str, Any]
Run Code Online (Sandbox Code Playgroud)

现在,在通过 PEP 585 的 Python 3.9 中,现在首选使用集合的内置类型,因此:

from typing import Any
my_dict = dict[str, Any]
Run Code Online (Sandbox Code Playgroud)

我是否仍然需要使用typing.Any或者是否有一个我找不到的内置类型来替换它?

python type-hinting python-typing python-3.9

12
推荐指数
1
解决办法
4340
查看次数

标签 统计

python ×1

python-3.9 ×1

python-typing ×1

type-hinting ×1