
March 15, 2023
5:55 p.m.
`np.dtype[TypeVar/Any/?]` has to still return the GenericAlias?
One thing I've found that is quite interesting is that if you don't return a `GenericAlias` from `__class_getitem__` some things work fine: ```python MyIntTtype = MyType[int] ``` But things break down if you try to mix that with things that do use `GenericAlias`: ```python MyTypeList = List[MyType[T]] # type variables from whatever MyType.__class_get_item__ returns are not collected MyIntTypeList = MyTypeList[int] # runtime error ``` This is because regular classes are excluded from the machinery that `List.__class_getitme__/GenericAlias.__class_getitem__` uses to collect type vars: https://github.com/python/cpython/blob/70185de1abfe428049a5c43d58fcb656b46db...