> I ran all of the samples through pyright and uncovered a few small errors. I pushed a PR that fixes these, and Guido already approved and merged the change.
Thanks, Eric, this is super helpful!
> Ah, thanks for noticing those, Eric. We had fixed some of these issues in our running Google Doc but not yet updated the PR. Will try to keep the PR more up-to-date.
+1; my bad.
> A variadic class without parameters will bind any `Ts` to `Tuple[Any, ...]`.
> So, in the above example, `x: Float32Array` will resolve to `Array[np.float32, *Tuple[Any, ...]]`.
This sounds reasonable to me too.
> There's one other thing that still troubles me with the latest draft. ... In its strictest mode, pyright complains about both `Ndim` and `Shape` missing type arguments.
Ah, also a great point.
Having thought about this a bit more, I'm actually wondering whether we can just drop that part of the PEP altogether. Dan Moldovan pointed out that maybe the example wouldn't make sense anyway, since an `Array[Ndim[Literal]]` wouldn't be compatible with an `Array[Shape[Any]]`, and that seems silly. So I think we should just get rid of `Ndim`, use a sequence of `Any` instead, and not support crazy things like `ShapeType = TypeVar('ShapeType', Ndim, Shape)` where we somehow have to support forwarding the type parameter to the type parameter lists of the bounds argghhh so complicated. That would leave us with just:
DataType = TypeVar('DataType')
Shape = TypeVarTuple('Shape')
class Array(Generic[DataType, *Shape]): ...
Float32Array = Array[np.float32, *Shape]
Array1D = Array[DataType, Any]
Array2D = Array[DataType, Any, Any]