Python3像静态语言一样定义变量,函参

注解(声明)函数参数类型

def add(x: int, y: int) -> int:
    return x + y

注解(声明)变量类型

z: str = ''

这样写可以给他人阅读源码时带来有用的提示。