def iter_strides_c_contig(arr, shape=None):
 shape = (arr.shape if (shape is None) else shape)
 itemsize = arr.itemsize
 def gen():
  (yield itemsize)
  sum = 1
  for s in reversed(shape[1:]):
   sum *= s
   (yield (sum * itemsize))
 for i in reversed(list(gen())):
  (yield i)

def iter_strides_c_contig ( arr , shape = None ) : shape = ( arr . shape if ( shape is None ) else shape ) itemsize = arr . itemsize def gen ( ) : ( yield itemsize ) sum = 1 for s in reversed ( shape [ 1 : ] ) : sum *= s ( yield ( sum * itemsize ) ) for i in reversed ( list ( gen ( ) ) ) : ( yield i )
yields the c-contigous strides .