# 函数的类型提示功能
# python 是解释型,强类型,动态类型
# name:str age:int hobbies:tuple
#
# 无类型提示
# def register(name,age,hobbies):
# print(name)
# print(age)
# print(hobbies)
# return 1111
# 函数的类型提示功能,整体返回成int类型
# def register(name:str,age:int,hobbies:tuple)->int:
# print(name)
# print(age)
# print(hobbies)
# return 1111
#
# res = register(1,'aaa',[1,])
# print(res)
#
# res = register('lsj',18,('play','music'))
# print(res)
# 加入默认参数
# def register(name:str='lsj',age:int=18,hobbies:tuple=(1,2))->int:
# print(name)
# print(age)
# print(hobbies)
# return 1111
#
# res = register('lsj',18,('play','music'))
# print(res)
#
# print("=============================")
# res = register() # 不传参
# print(res)
# :冒号后跟的是提示信息
def register(name:'必须传入名字',age:111,hobbies:'必须传入元组')->'返回的是整型int':
print(name)
print(age)
print(hobbies)
return 1111
res = register('lsj',18,('play','music'))
print(res)
# 查看提示信息功能
print(register.__annotations__)
# {'name': '必须传入名字', 'age': 111, 'hobbies': '必须传入元组', 'return': '返回的是整型int'}