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

Skip to content

Commit e0b9394

Browse files
mathandyminrk
authored andcommitted
Add comma groupings to timeit magic loop count
1 parent 6563794 commit e0b9394

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

IPython/core/magics/execution.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,15 @@ def __str__(self):
9292
pm = u'\xb1'
9393
except:
9494
pass
95-
return (
96-
u"{mean} {pm} {std} per loop (mean {pm} std. dev. of {runs} run{run_plural}, {loops} loop{loop_plural} each)"
97-
.format(
98-
pm = pm,
99-
runs = self.repeat,
100-
loops = self.loops,
101-
loop_plural = "" if self.loops == 1 else "s",
102-
run_plural = "" if self.repeat == 1 else "s",
103-
mean = _format_time(self.average, self._precision),
104-
std = _format_time(self.stdev, self._precision))
105-
)
95+
return "{mean} {pm} {std} per loop (mean {pm} std. dev. of {runs} run{run_plural}, {loops:,} loop{loop_plural} each)".format(
96+
pm=pm,
97+
runs=self.repeat,
98+
loops=self.loops,
99+
loop_plural="" if self.loops == 1 else "s",
100+
run_plural="" if self.repeat == 1 else "s",
101+
mean=_format_time(self.average, self._precision),
102+
std=_format_time(self.stdev, self._precision),
103+
)
106104

107105
def _repr_pretty_(self, p , cycle):
108106
unic = self.__str__()

0 commit comments

Comments
 (0)