Skip to content

Commit 73140de

Browse files
hugovkrbtcollins
andauthored
bpo-23183: Document the timeit output (GH-30359)
Co-authored-by: Robert Collins <[email protected]>
1 parent 71c0b85 commit 73140de

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Doc/library/timeit.rst

+7
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ It is possible to provide a setup statement that is executed only once at the be
282282
$ python -m timeit -s 'text = "sample string"; char = "g"' 'text.find(char)'
283283
1000000 loops, best of 5: 0.342 usec per loop
284284
285+
In the output, there are three fields. The loop count, which tells you how many
286+
times the statement body was run per timing loop repetition. The repetition
287+
count ('best of 5') which tells you how many times the timing loop was
288+
repeated, and finally the time the statement body took on average within the
289+
best repetition of the timing loop. That is, the time the fastest repetition
290+
took divided by the loop count.
291+
285292
::
286293

287294
>>> import timeit

0 commit comments

Comments
 (0)