-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
mypy=0.800
python=3.8.6
The following code generates
error: Incompatible return value type (got "str", expected "Union[ndarray, T]")
from __future__ import annotations
from typing import TypeVar, Union
import numpy
T = TypeVar("T")
def _test(a: list[T]) -> Union[numpy.ndarray, T]:
if isinstance(a[0], str):
return a[0]
return numpy.array(a)
jourdanrodrigues, mrwonko, aucampia, JSS95, ObserverOfTime and 9 more
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong