def genslices_ndim(ndim, shape):
 iterables = [genslices(shape[n]) for n in range(ndim)]
 return product(*iterables)

def genslices_ndim ( ndim , shape ) : iterables = [ genslices ( shape [ n ] ) for n in range ( ndim ) ] return product ( * iterables )
generate all possible slice tuples for shape .