Skip to content

NDArrayLike Typing with newer numpy typing #3780

@ilan-gold

Description

@ilan-gold
NDArrayLike typing is wrong for things like ravel - is there a way to turn this off in numpy? I am having trouble making it work using -> NDArrayLike[...] i.e., numpy expects -> np.ndarray[tuple[int], dtype] because ravel flattens but currently we return Self which is wrong then if Self has ndims > 1

from #3564 (comment) (where we moved to python 3.14 and a higher version of numpy for mypy)

I think basically a lot of the methods on NDArrayLike need to be parametrized by their shape/dtype. The above comment is probably wrong since ravel is one of the ones that might actually work. Instead things like reshape need to parametrized

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