Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cafd7d4

Browse files
committed
Fix loop logic
1 parent 19e214e commit cafd7d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

IPython/utils/text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ def _col_chunks(l, nrows, row_first=False):
623623
if row_first:
624624
ncols = (len(l) // nrows) + (len(l) % nrows > 0)
625625
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)]
627627
else:
628628
for i in py3compat.xrange(0, len(l), nrows):
629629
yield l[i:(i + nrows)]
@@ -712,7 +712,7 @@ def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :
712712
info = _find_optimal(list(map(len, items)), row_first, *args, **kwargs)
713713
nrow, ncol = info['num_rows'], info['num_columns']
714714
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)
716716
else:
717717
return ([[_get_or_default(items, c * nrow + r, default=empty) for c in range(ncol)] for r in range(nrow)], info)
718718

0 commit comments

Comments
 (0)