def _get_axis(indexes):
 ndim = len(indexes)
 indexes = [(slice(None, None) if (i is None) else [0]) for i in indexes]
 x = np.empty(((2,) * ndim))
 x2 = x[tuple(indexes)]
 return x2.shape.index(1)

def _get_axis ( indexes ) : ndim = len ( indexes ) indexes = [ ( slice ( None , None ) if ( i is None ) else [ 0 ] ) for i in indexes ] x = np . empty ( ( ( 2 , ) * ndim ) ) x2 = x [ tuple ( indexes ) ] return x2 . shape . index ( 1 )
get axis along which point-wise slicing results lie this is mostly a hack because i cant figure out numpys rule on this and cant be bothered to go reading .