From 06df2b1d220867a8c85f28bf0bb1951cdc08ee8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 14 Feb 2026 21:18:02 +0200 Subject: [PATCH] docs: improve timeit autorange description It not only determines but actually runs timeit a number of times. Also be more concise; the original form said basically the same thing twice. --- Doc/library/timeit.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index bc12061a2aeb2d..fc5e2b13922396 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -145,13 +145,12 @@ The module defines three convenience functions and a public class: .. method:: Timer.autorange(callback=None) - Automatically determine how many times to call :meth:`.timeit`. + Call :meth:`.timeit` automatically determined number of times. This is a convenience function that calls :meth:`.timeit` repeatedly - so that the total time >= 0.2 second, returning the eventual - (number of loops, time taken for that number of loops). It calls - :meth:`.timeit` with increasing numbers from the sequence 1, 2, 5, - 10, 20, 50, ... until the time taken is at least 0.2 seconds. + with increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... + until the time taken is at least 0.2 seconds, returning the eventual + (number of loops, time taken for that number of loops). If *callback* is given and is not ``None``, it will be called after each trial with two arguments: ``callback(number, time_taken)``.