
By the way, a second problem with __getitem__ and __setitem__ is they are really messy to type (and this likely would make it worse). If, however, there was a new __getindex__ and __setindex__ with normal Python *args and **kwargs symantics, that would be really easy to type. For example, when I recently added typing to getitem in boost-histogram/hist: InnerIndexing = Union[SupportsIndex, str, Callable[[bh.axis.Axis], int], slice] IndexingWithMapping = Union[InnerIndexing, Mapping[Union[int, str], InnerIndexing]] IndexingExpr = Union[IndexingWithMapping, Tuple[IndexingWithMapping, ...]] def __getitem__(self, item: IndexingExpr) (And pretty much the first thing I tried it on was h[...] = , which of course fails a type check, because I forgot "ellipsis" (discussion in typing-sig). It's also really hard to use types internally, due to the Tuple and non-Tuple versions. If this was a normal expression, then something like: InnerIndexing = Union[SupportsIndex, str, Callable[[bh.axis.Axis], int], slice] def __getindex__(self, *args: IndexingExpr | Mapping[int | str, IndexingExpr], **kwargs: IndexingExpr) Would work and be significantly simpler, both inside and out.