[Python] How do I declare a numpy array to be 1 dimensional of arbitrary length?

Discussão em 'Python' iniciado por Stack, Agosto 19, 2025.

  1. Stack

    Stack Membro Participativo

    I am working on a python code base and the team has decided to make everything statically typed. I want to declare a numpy array of floats to be one dimension, with arbitrary length. I currently have the following:

    float64 = np.dtype[np.float64]
    floats = np.ndarray[Any, float64]


    What exactly is the role of Any in this case? Does this declaration permit multi-dimensional arrays? How do I statically differentiate between 1, 2, or 3 dimensional arrays?

    Continue reading...

Compartilhe esta Página