API/DEPR: Index.view _typ check, return type · Issue #55709 · pandas-dev/pandas (original) (raw)
Index.view has a cls
argument (instead of dtype, which I would expect) and starts with:
# we need to see if we are subclassing an
# index type here
if cls is not None and not hasattr(cls, "_typ"):
The "_typ" check must have been intended to catch types defined in pd.core.dtypes.generic, but it isn't clear to me why we do that.
Let's just have view take a dtype keyword like Series.view.
update: also it sometimes returns an Index and other times an ArrayLike. let's choose just one.