intro-to-python
intro-to-python copied to clipboard
Static Typing / Function Annotations
Add this to the notes about functions:
"for example, this function is expected to take two int arguments and is also expected to have an int return value:"
def sum_two_numbers(a: int, b: int) -> int:
return a + b
References:
- https://docs.python.org/3/glossary.html#term-type-hint
- https://docs.python.org/3/glossary.html#term-function-annotation