What does -> mean in Python function definitions?
In Python, the "->" symbol is used to indicate the return type of a function. It is part of the function definition in a Python 3.5 or later. For example, the following code defines a function
add that takes in two arguments,
b, and returns the sum of the two arguments.
def add(a: int, b: int) -> int: return a + b
-> int at the end of the function definition indicates that the function returns an integer. This is known as type hinting and is used to help with code readability and debugging.
Please note that this feature is not enforced in Python and it's just used as a hint for developer and IDEs.