On Mon, Jul 23, 2018 at 4:24 AM Paul Moore <p.f.moore@gmail.com> wrote:
I thought the reason the proposal got nowhere was because it's pretty
simple to define it yourself:

>>> class SliceHelper:
...     def __getitem__(self, slice):
...         return slice
...
>>> SH = SliceHelper()
>>> SH[1::3]
slice(1, None, 3)

Did I miss something significant about why this wasn't sufficient?

I think a SliceHelper class like this is a reasonable solution, but there would be a lot of value having it a standard place somewhere in the standard library (e.g., operator.subscript).

Both pandas and NumPy include this helper object under different names (pandas.IndexSlice and numpy.index_exp / numpy.s_), but it would be surprising/unexpected for pandas/numpy specific helpers to show up when not using one of those libraries. I do the exact same sorts of indexing manipulations with xarray, dask and TensorFlow.

Given that this is basically a simple feature to make it easier to work with Python syntax (so there's no danger it will change in the future), I think there is a lot to be said for putting it in the standard library in one place so it's obvious what to use and users don't have to relearn that name for this object and/or reimplement it.