python type hints return code example
Example 1: python function argument type
def pick(l: list, index: int) -> int:
return l[index]
Example 2: python type hints
def no_type_hint(arg):
print(arg) # arg can be anything
def with_type_hint(arg: str):
print(arg) # arg must be a string or a subtype of string
Example 3: python typing list of strings
from typing import List
def my_func(l: List[int]):
pass