array-api icon indicating copy to clipboard operation
array-api copied to clipboard

Disallowed typing in `linalg.vector_norm`

Open lucascolley opened this issue 7 months ago • 4 comments

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: https://github.com/python/typing/issues/1160


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

lucascolley avatar Jul 01 '24 11:07 lucascolley