0
What does -> do in python?
For example how does it effect the code down below? def f(x) -> int: return x print(f(12.3))
1 Answer
+ 5
It's an annotation that the function should return an integer. In your example, it will return a float. That's a bit misleading but technically okay because the interpreter will just ignore these annotations.