相关疑难解决方法(0)

mypy,type提示:Union [float,int] - >是否有Number类型?

mypy非常方便并且捕获了很多错误,但是当我编写"科学"应用程序时,我经常最终会这样做:

def my_func(number: Union[float, int]):
    # Do something
Run Code Online (Sandbox Code Playgroud)

number是浮点数还是int,具体取决于用户的输入.有官方的方法吗?

python type-hinting mypy

28
推荐指数
3
解决办法
3270
查看次数

标签 统计

mypy ×1

python ×1

type-hinting ×1