I'm giving the Python typing
module a shot.
I know that it's valid to specify the length of a List
like the following*:
List[float, float, float] # List of 3 floats <-- NOTE: this is not valid Python
Is there any shorthand for longer lists? What if I want to set it to 10 floats?
List[float * 10] # This doesn't work.
Any idea if this is possible, this would be handy.
*NOTE: It turns out that supplying multiple arguments to Sequence[]
(and its subclasses) in this manner is currently NOT valid Python. Furthermore, it is currently not possible to specify a Sequence
length using the typing
module in this way.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…