Skip to content

Commit 249543b

Browse files
miikkahugovkStanFromIreland
authored
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]>
1 parent 707645e commit 249543b

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Doc/library/timeit.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The module defines three convenience functions and a public class:
7373
.. versionchanged:: 3.5
7474
The optional *globals* parameter was added.
7575

76-
.. versionchanged:: 3.8
76+
.. versionchanged:: next
7777
The optional *target_time* parameter was added.
7878

7979

@@ -92,7 +92,7 @@ The module defines three convenience functions and a public class:
9292
.. versionchanged:: 3.7
9393
Default value of *repeat* changed from 3 to 5.
9494

95-
.. versionchanged:: 3.15
95+
.. versionchanged:: next
9696
The optional *target_time* parameter was added.
9797

9898
.. function:: default_timer()
@@ -130,7 +130,7 @@ The module defines three convenience functions and a public class:
130130
.. versionchanged:: 3.5
131131
The optional *globals* parameter was added.
132132

133-
.. versionchanged:: 3.8
133+
.. versionchanged:: next
134134
The optional *target_time* parameter was added.
135135

136136
.. method:: Timer.timeit(number=1000000)
@@ -250,11 +250,11 @@ Where the following options are understood:
250250

251251
.. versionadded:: 3.5
252252

253-
.. cmdoption:: -t, --target_time=T
253+
.. option:: -t, --target-time=T
254254

255255
calls :meth:`.timeit` repeatedly so that the total time >= *target_time* seconds
256256

257-
.. versionadded:: 3.15
257+
.. versionadded:: next
258258

259259
.. cmdoption:: -v, --verbose
260260

Lib/timeit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
-p/--process: use time.process_time() (default is time.perf_counter())
1818
-v/--verbose: print raw timing results; repeat for more digits precision
1919
-u/--unit: set the output time unit (nsec, usec, msec, or sec)
20-
-t/--target_time T: if number is 0 the code will run until it
21-
takes *at least* ``target_time`` seconds
20+
-t/--target-time T: if --number is 0 the code will run until it
21+
takes *at least* this many seconds
2222
(default: 0.2)
2323
-h/--help: print this usage message and exit
2424
--: separate options from statement, use when statement starts with -
@@ -31,7 +31,7 @@
3131
3232
If -n is not given, a suitable number of loops is calculated by trying
3333
increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the
34-
total time is at least target_time seconds.
34+
total time is at least --target-time seconds.
3535
3636
Note: there is a certain baseline overhead associated with executing a
3737
pass statement. It differs between versions. The code here doesn't try
@@ -319,7 +319,7 @@ def main(args=None, *, _wrap_timer=None):
319319
repeat = 1
320320
if o in ("-p", "--process"):
321321
timer = time.process_time
322-
if o in ("-t", "--target_time"):
322+
if o in ("-t", "--target-time"):
323323
target_time = float(a)
324324
if o in ("-v", "--verbose"):
325325
if verbose:

Misc/NEWS.d/next/Library/2019-04-25-21-11-37.bpo-36461.TO5YyP.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
In timeit module:
1+
:mod:`timeit`:
22
- added a new parameter *target_time* to :func:`timeit.timeit` and
33
:func:`timeit.repeat` methods and :class:`timeit.Timer` class;
44
- had ``timeit`` and ``repeat`` methods (and functions) fall back

0 commit comments

Comments
 (0)