def f(ham: str, eggs: str = 'eggs') -> str:
print("Annotations:", f.__annotations__)
print("Arguments:", ham, eggs)
return ham + ' and ' + eggs
这些是类型提示。各种类型的检查器可以使用它们来确定您是否使用了正确的类型。
提示输出为str类型。
def f(ham: str, eggs: str = 'eggs') -> str:
print("Annotations:", f.__annotations__)
print("Arguments:", ham, eggs)
return ham + ' and ' + eggs
这些是类型提示。各种类型的检查器可以使用它们来确定您是否使用了正确的类型。
提示输出为str类型。