📜  nums: Python 函数中的 List[int] - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:12.383000             🧑  作者: Mango

代码示例1
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])