##// END OF EJS Templates
Fix loop logic
naught101 -
Show More
@@ -623,7 +623,7 b' def _col_chunks(l, nrows, row_first=False):'
623 if row_first:
623 if row_first:
624 ncols = (len(l) // nrows) + (len(l) % nrows > 0)
624 ncols = (len(l) // nrows) + (len(l) % nrows > 0)
625 for i in py3compat.xrange(ncols):
625 for i in py3compat.xrange(ncols):
626 yield [l[j] for j in py3compat.xrange(i, len(l), nrows)]
626 yield [l[j] for j in py3compat.xrange(i, len(l), ncols)]
627 else:
627 else:
628 for i in py3compat.xrange(0, len(l), nrows):
628 for i in py3compat.xrange(0, len(l), nrows):
629 yield l[i:(i + nrows)]
629 yield l[i:(i + nrows)]
@@ -712,7 +712,7 b' def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :'
712 info = _find_optimal(list(map(len, items)), row_first, *args, **kwargs)
712 info = _find_optimal(list(map(len, items)), row_first, *args, **kwargs)
713 nrow, ncol = info['num_rows'], info['num_columns']
713 nrow, ncol = info['num_rows'], info['num_columns']
714 if row_first:
714 if row_first:
715 return ([[_get_or_default(items, c * nrow + r, default=empty) for r in range(nrow)] for c in range(ncol)], info)
715 return ([[_get_or_default(items, r * ncol + c, default=empty) for c in range(ncol)] for r in range(nrow)], info)
716 else:
716 else:
717 return ([[_get_or_default(items, c * nrow + r, default=empty) for c in range(ncol)] for r in range(nrow)], info)
717 return ([[_get_or_default(items, c * nrow + r, default=empty) for c in range(ncol)] for r in range(nrow)], info)
718
718
General Comments 0
You need to be logged in to leave comments. Login now