Kaydet (Commit) 8da5ebe1 authored tarafından Anders Hovmöller's avatar Anders Hovmöller Kaydeden (comit) Victor Stinner

bpo-35138: Added an example for timeit.timeit with callable arguments (GH-9787)



* Update timeit.rst
üst b6a09ae2
......@@ -44,8 +44,12 @@ This can be achieved from the :ref:`python-interface` with::
>>> timeit.timeit('"-".join(map(str, range(100)))', number=10000)
0.23702679807320237
A callable can also be passed from the :ref:`python-interface`::
Note however that :mod:`timeit` will automatically determine the number of
>>> timeit.timeit(lambda: "-".join(map(str, range(100))), number=10000)
0.19665591977536678
Note however that :func:`.timeit` will automatically determine the number of
repetitions only when the command-line interface is used. In the
:ref:`timeit-examples` section you can find more advanced examples.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment