【笔记】Python3类型标注

前言

Python3类型标注学习笔记

函数形参的标注

1
2
def 函数名(参数名:形参的数据类型):
...

构造方法的形参

1
2
3
class 类名:
def __init__(self, 参数名:形参的数据类型):
...

返回值的标注

1
2
def 函数名() -> 返回值的数据类型:
return ...

完成