Recently, I have come across this ->
in Python 3 when studying function declarations. What does this do and mean? I have never seen such a declaration other than in a Javascript function declaration up until now.
def f(self, s: 'str') -> 'bool':
pass
This is annotation for type of return value of function.
def sum() -> expression:
That is, the parameter list can now be followed by a literal -> and a Python expression. Like the annotations for parameters, this expression will be evaluated when the function definition is executed.