Skip to content

Disallowed typing in linalg.vector_norm #817

Open
@lucascolley

Description

@lucascolley

Spec:

ord: int | float | ~typing.Literal[inf, -inf] = 2

Stubs:

ord: Union[int, float, Literal[inf, -inf]] = 2

Literals docs

The following are provisionally disallowed for simplicity. We can consider allowing them in the future.

  • Floats: e.g. Literal[3.14]. Representing Literals of infinity or NaN in a clean way is tricky; real-world APIs are unlikely to vary their behavior based on a float parameter.

A relevant issue: python/typing#1160


I don't know if anything can be done, and this was probably done deliberately, but useful to have an issue nonetheless.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions