def add(x: int, y: int) -> int:
return x+y
This is valid Python 3 code!
def square(x):
"""Computes square of a number."""
return x*x
>>> square.__name__
'square'
>>> square.__module__
'__main__'
>>> square.__doc__
'Computes square of a number.'
Anand Chitipothu http://anandology.com/ @anandology
Slides: http://anandology.com/presentations/python3-function-anotations
Functions Anotations in Python 3 | 1 |
---|---|
How about this? | 2 |
Function metadata | 3 |
Annotations are function metadata | 4 |
What is mypy? | 5 |
References | 6 |
Questions? | 7 |
Table of Contents | t |
---|---|
Exposé | ESC |
Full screen slides | e |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide slide context | c |
Notes | 2 |
Help | h |