Why isn't np.ndarray a valid type?

Viewed 928

I have Vector = np.ndarray, but MyPy later on gives me the error Variable "main.Vector" is not valid as a type [valid-type].

Why?

This issue seems to be the closest, though I did not understand the explanation. This issue also seems related.

Complete code for reference:

import numpy as np
from typing import List, Union

Vector = np.ndarray
VectorLike = Union[List[float], Vector]
0 Answers
Related