For example, for slice(None), [0, 1, 0] on an array of shape (3, 2), it should list
(0, 0)
(0, 1)
(0, 0)
(1, 0)
(1, 1)
(1, 0)
(2, 0)
(2, 1)
(2, 0)
The function would always take in a shape.
I think this should be pretty straightforward to implement. Just call expand() on the index and iterate through an itertools.product.
The function should maybe be called idx.selected_elements(shape).