Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Not supported: np.float32() can accept a list and produce an ndarray #41

@mikolajz

Description

@mikolajz

The following code works but doesn't pass type checking:

x = None  # type: Optional[np.ndarray]
x = np.float32([1.0, 0.0, 0.0])
assert isinstance(x, np.ndarray)

But I don't know if this can be expressed in mypy - when I tried adding @overload def __new__(cls, x: List[float]) -> ndarray: ..., mypy now accepted the arguments but ignored the return type and assumed this produces an np.float32.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions