Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-28240: timeit: Update repeat() doc #7419

Merged
merged 3 commits into from
Jun 6, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Doc/library/timeit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The module defines three convenience functions and a public class:
The optional *globals* parameter was added.


.. function:: repeat(stmt='pass', setup='pass', timer=<default timer>, repeat=3, number=1000000, globals=None)
.. function:: repeat(stmt='pass', setup='pass', timer=<default timer>, repeat=5, number=1000000, globals=None)

Create a :class:`Timer` instance with the given statement, *setup* code and
*timer* function and run its :meth:`.repeat` method with the given *repeat*
Expand All @@ -79,6 +79,9 @@ The module defines three convenience functions and a public class:
.. versionchanged:: 3.5
The optional *globals* parameter was added.

.. versionchanged:: 3.7
Default value of *repeat* changed from 3 to 5.

.. function:: default_timer()

The default timer, which is always :func:`time.perf_counter`.
Expand Down Expand Up @@ -150,7 +153,7 @@ The module defines three convenience functions and a public class:
.. versionadded:: 3.6


.. method:: Timer.repeat(repeat=3, number=1000000)
.. method:: Timer.repeat(repeat=5, number=1000000)

Call :meth:`.timeit` a few times.

Expand All @@ -171,6 +174,9 @@ The module defines three convenience functions and a public class:
should be interested in. After that, you should look at the entire
vector and apply common sense rather than statistics.

.. versionchanged:: 3.7
Default value of *repeat* changed from 3 to 5.


.. method:: Timer.print_exc(file=None)

Expand Down
4 changes: 2 additions & 2 deletions Lib/timeit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

Options:
-n/--number N: how many times to execute 'statement' (default: see below)
-r/--repeat N: how many times to repeat the timer (default 3)
-r/--repeat N: how many times to repeat the timer (default 5)
-s/--setup S: statement to be executed once initially (default 'pass').
Execution time of this setup statement is NOT timed.
-p/--process: use time.process_time() (default is time.perf_counter())
Expand Down Expand Up @@ -184,7 +184,7 @@ def repeat(self, repeat=default_repeat, number=default_number):

This is a convenience function that calls the timeit()
repeatedly, returning a list of results. The first argument
specifies how many times to call timeit(), defaulting to 3;
specifies how many times to call timeit(), defaulting to 5;
the second argument specifies the timer argument, defaulting
to one million.

Expand Down