Considering to Python Docs for typing
why code below isn't working?
>>> Vector = list[float]
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: 'type' object is not subscriptable
In docs there is the same example as I mentioned above. here
Vector = list[float]
def scale(scalar: float, vector: Vector) -> Vector:
return [scalar * num for num in vector]
I didn't find question about this example.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…