Files
Python_CookBook_repo/7.函数/3.将元数据信息附加到函数参数上.py

5 lines
187 B
Python
Raw Permalink Normal View History

2025-09-10 16:12:45 +08:00
# 有时候我们会想要将函数参数加上类型提示来方便其他人快速熟悉函数,那么可以这样做:
def test_function(x:int, y:int)->int:
x = x**2
return x+y