Skip to content

typing aliases for integer-like #18096

Closed
@rgommers

Description

@rgommers

When trying to use numpy.typing-provided aliases for integer-like scalars in scipy/scipy#10844 (review), I noticed that numpy.typing doesn't have the right alias. It does have:

_IntLike = Union[_BoolLike, int, np.integer]

but accepting bools as 0/1 where integers are expected isn't good practice.

Accepting integers for float-like is fine, and mypy does accept int if you annotate a variable as float. Complex I'm not sure about, but I'd think it's undesirable to accept ints/floats for complex-like.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions