@contextmanager
def loop_nest(builder, shape, intp, order='C'):
 assert (order in 'CF')
 if (not shape):
  (yield ())
 else:
  if (order == 'F'):
   _swap = (lambda x: x[::(-1)])
  else:
   _swap = (lambda x: x)
  with _loop_nest(builder, _swap(shape), intp) as indices:
   assert (len(indices) == len(shape))
   (yield _swap(indices))

@ contextmanager def loop_nest ( builder , shape , intp , order = 'C' ) : assert ( order in 'CF' ) if ( not shape ) : ( yield ( ) ) else : if ( order == 'F' ) : _swap = ( lambda x : x [ : : ( - 1 ) ] ) else : _swap = ( lambda x : x ) with _loop_nest ( builder , _swap ( shape ) , intp ) as indices : assert ( len ( indices ) == len ( shape ) ) ( yield _swap ( indices ) )
generate a loop nest walking a n-dimensional array .