class Array(Generic[*Shape]): def __init__(self, shape: Tuple[*Shape]): self._shape: Tuple[*Shape] = shape def get_shape(self) -> Tuple[*Shape]: return self._shape shape = (Height(480), Width(640)) x: Array[Height, Width] = Array(shape) y = abs(x) # Inferred type is Array[Height, Width] z = x + x # ... is Array[Height, Width]