小编Kro*_*hka的帖子

竖线“|”是什么意思 (管道)在函数参数类型注释中是什么意思?

我遇到了带有这样签名的函数:

def get_quantile(numbers: List[float], q: float | int ) -> float | int | None :
Run Code Online (Sandbox Code Playgroud)

这是什么意思?

这是我的 python 3.8 上的语法错误。我需要从中导入一些东西future才能使其工作吗?

python type-hinting python-3.x type-annotation

4
推荐指数
1
解决办法
302
查看次数