小编Evi*_*inK的帖子

代码 '_T = TypeVar('_T')' 在 *.pyi 文件中是什么意思?

我是 Python 注释的新手(类型提示)。我注意到文件中的许多类定义pyi都继承了Generic[_T], 和_T = TypeVar('_T').

我很困惑,_T这里是什么意思?

from typing import Generic, TypeVar

_T = TypeVar('_T')

class Base(Generic[_T]): pass
Run Code Online (Sandbox Code Playgroud)

python annotations type-hinting pyi

7
推荐指数
1
解决办法
2416
查看次数

标签 统计

annotations ×1

pyi ×1

python ×1

type-hinting ×1