def iter_strides_f_contig(arr, shape=None):
 shape = (arr.shape if (shape is None) else shape)
 itemsize = arr.itemsize
 (yield itemsize)
 sum = 1
 for s in shape[:(-1)]:
  sum *= s
  (yield (sum * itemsize))

def iter_strides_f_contig ( arr , shape = None ) : shape = ( arr . shape if ( shape is None ) else shape ) itemsize = arr . itemsize ( yield itemsize ) sum = 1 for s in shape [ : ( - 1 ) ] : sum *= s ( yield ( sum * itemsize ) )
yields the f-contigous strides .