bpo-28240: timeit: Update repeat() doc (GH-7419) · python/cpython@3ef769f (original) (raw)
`@@ -69,7 +69,7 @@ The module defines three convenience functions and a public class:
`
69
69
` The optional globals parameter was added.
`
70
70
``
71
71
``
72
``
`-
.. function:: repeat(stmt='pass', setup='pass', timer=, repeat=3, number=1000000, globals=None)
`
``
72
`+
.. function:: repeat(stmt='pass', setup='pass', timer=, repeat=5, number=1000000, globals=None)
`
73
73
``
74
74
`` Create a :class:Timer
instance with the given statement, setup code and
``
75
75
`` timer function and run its :meth:.repeat
method with the given repeat
``
`@@ -79,6 +79,9 @@ The module defines three convenience functions and a public class:
`
79
79
` .. versionchanged:: 3.5
`
80
80
` The optional globals parameter was added.
`
81
81
``
``
82
`+
.. versionchanged:: 3.7
`
``
83
`+
Default value of repeat changed from 3 to 5.
`
``
84
+
82
85
`.. function:: default_timer()
`
83
86
``
84
87
`` The default timer, which is always :func:time.perf_counter
.
``
`@@ -150,7 +153,7 @@ The module defines three convenience functions and a public class:
`
150
153
` .. versionadded:: 3.6
`
151
154
``
152
155
``
153
``
`-
.. method:: Timer.repeat(repeat=3, number=1000000)
`
``
156
`+
.. method:: Timer.repeat(repeat=5, number=1000000)
`
154
157
``
155
158
`` Call :meth:.timeit
a few times.
``
156
159
``
`@@ -171,6 +174,9 @@ The module defines three convenience functions and a public class:
`
171
174
` should be interested in. After that, you should look at the entire
`
172
175
` vector and apply common sense rather than statistics.
`
173
176
``
``
177
`+
.. versionchanged:: 3.7
`
``
178
`+
Default value of repeat changed from 3 to 5.
`
``
179
+
174
180
``
175
181
` .. method:: Timer.print_exc(file=None)
`
176
182
``
`@@ -208,7 +214,7 @@ Where the following options are understood:
`
208
214
``
209
215
`.. cmdoption:: -r N, --repeat=N
`
210
216
``
211
``
`-
how many times to repeat the timer (default 3)
`
``
217
`+
how many times to repeat the timer (default 5)
`
212
218
``
213
219
`.. cmdoption:: -s S, --setup=S
`
214
220
``
`@@ -246,7 +252,7 @@ successive powers of 10 until the total time is at least 0.2 seconds.
`
246
252
`` :func:default_timer
measurements can be affected by other programs running on
``
247
253
`the same machine, so the best thing to do when accurate timing is necessary is
`
248
254
`` to repeat the timing a few times and use the best time. The :option:-r
``
249
``
`-
option is good for this; the default of 3 repetitions is probably enough in
`
``
255
`+
option is good for this; the default of 5 repetitions is probably enough in
`
250
256
`` most cases. You can use :func:time.process_time
to measure CPU time.
``
251
257
``
252
258
`.. note::
`