How to explain -> Vector: in Python
what does this mean in python
from typing import List
Vector = List[float]
def scale(scalar: float, vector: Vector) -> Vector:
return [scalar * num for num in vector]
# typechecks; a list of floats qualifies as a Vector.
new_vector = scale(2.0, [1.0, -4.2, 5.4])
Its Function Annotations: PEP 3107 -- Function Annotations. Also look at this post: What does -> mean in Python function definitions?