小编Pre*_*sch的帖子

我应该在 Python 3.9+ 中使用大写 L 列表进行类型提示吗?

在 Python 3.9+ 中,我可以编写list_of_integers: list[int],但我看到高级开发人员使用旧语法(即使在 Python 3.9 和 3.10 脚本中):

from typing import List

list_of_integers: List[int]
Run Code Online (Sandbox Code Playgroud)

这对于向后兼容性和明确性来说是否优越?

python python-typing

11
推荐指数
1
解决办法
2992
查看次数

标签 统计

python ×1

python-typing ×1