I suspect you just need to bore the analysis of each dimension to create either a new slice or an array of indices. I doubt there is a short cut.
To illustrate your example:
In [77]: shape=(100,100,100) In [78]: outer_slice=(slice(None, None, 2), 7, slice(None, None, None)) In [79]: inner_slice=(1, slice(None, None, -1))
Target (right?):
(2, 7, slice(None,None,-1))
First dimension - create an array of the entire range of indices and slice them sequentially:
In [80]: idx=np.arange(shape[0]) In [81]: idx[outer_slice[0]][inner_slice[0]] Out[81]: 2
Can this be inferred from [:: 2] and [1]? I should think that it starts at 0, the form is large enough to get the second value, etc.
Now for the second dimension. This is a scalar, so there is no corresponding inner segment.
In [82]: outer_slice[1] Out[82]: 7
For the third, we will do the same as with the 1st, but taking into account the offset between the external and internal lists:
In [83]: idx=np.arange(shape[2]) In [84]: idx[outer_slice[2]][inner_slice[1]] Out[84]: array([99, 98, 97, 96, 95, 94, 93, 92, 91, ....7, 6, 5, 4, 3, 2, 1, 0])
Or I could conclude that outer_slice[2] does nothing, so I can use inner_slice[1] directly.
Of course, it would be just as simple and effective to apply two slice sets to a real array.
X[outer_slice][inner_slice]
While outer_slice creates a view, combining them into a composite slice is not a big improvement.
With the shape and fragments of the tuples, there is enough information to create a new tuple. But, apparently, the required logic will be fully involved and requires a deep knowledge of cutting and a large number of tests.