在 [[Python]] 中类型注解不会进行额外的效验。
函数注解
def add(x:int, y:int) ->: return x + y
变量注解
from typing import List****
x: int = 42y: str = 'answer'z: List[int] = [42,]
在 [[Python]] 中类型注解不会进行额外的效验。
def add(x:int, y:int) ->: return x + y
from typing import List****
x: int = 42y: str = 'answer'z: List[int] = [42,]