python specify variable type in method code example
Example 1: specify return type python function
def greeting(name: str) -> str:
return 'Hello, {}'.format(name)
Example 2: python type constraint
# Example of typing constraint in python (From 3.5)
def greeting(name: str) -> str:
return 'Hello ' + name