You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PEP 646 Variadic Generics have landed in python 3.11, which allow generics to be written that accept a variable number of arguments, and the prime use-case is for numpy-like arrays. As far as I can tell however, neither numpy itself, nor the python standard library ship actual typings making use of that. Given that nptyping already supports that use-case just through the use of strings instead of variadic generics, it may be reasonable to extend to the new syntax. Is that something which aligns with the library's vision?
The text was updated successfully, but these errors were encountered:
Variadic generics are indeed on this library's radar. I would use it to support more generic types, for example indices in DataFrames. This is how it could look like:
fromnptypingimportStructureasS, Index# note: Index does not exist yetDataFrame[S["a: Int, b: Float"]] # hint a structured DataFrameDataFrame[Index["a"]] # only hint an indexDataFrame[S["a: Int, b: Float"], Index["a"]] # hint a structure and an index
However, mypy support is still in progress (see python/mypy#12280) and nptyping wants to stay mypy-compliant. Once mypy has implemented support, nptyping will follow.
PEP 646 Variadic Generics have landed in python 3.11, which allow generics to be written that accept a variable number of arguments, and the prime use-case is for numpy-like arrays. As far as I can tell however, neither numpy itself, nor the python standard library ship actual typings making use of that. Given that
nptyping
already supports that use-case just through the use of strings instead of variadic generics, it may be reasonable to extend to the new syntax. Is that something which aligns with the library's vision?The text was updated successfully, but these errors were encountered: