python syntax - Parameter Comment
This code recently encountered:
def func(a:"shuoming") -> int:
print ( "function has been run.")
func(34)
Check that it is a new parameter annotation mode, introduced in 3.5.
Parameter Comment colon as the delimiter, so as to function annotation -> a delimiter.
This information is stored in __annotations__ property function.
It's just an illustration, and there is no mandatory inspection function, below show you different and __doc__ of.
def func(a:"shuoming", *ar:"shuoming2") -> int:
"""注释"""
print ( "function has been run.")
func(34)
print(func.__doc__)
print(func.__annotations__)
Output:
Function has been run.
Note
{'a': 'shuoming', 'ar': 'shuoming2', 'return': <class 'int'>}