Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 44da19a

Browse files
committed
#18518: mention that including a return statement changes/breaks the behaviour
1 parent 40470e0 commit 44da19a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Doc/library/timeit.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ The module defines three convenience functions and a public class:
6363
Create a :class:`Timer` instance with the given statement, *setup* code and
6464
*timer* function and run its :meth:`.timeit` method with *number* executions.
6565

66+
.. note::
67+
68+
Because :meth:`.timeit` is executing *stmt*, placing a return statement
69+
in *stmt* will prevent :meth:`.timeit` from returning execution time.
70+
It will instead return the data specified by your return statement.
71+
6672

6773
.. function:: repeat(stmt='pass', setup='pass', timer=<default timer>, repeat=3, number=1000000)
6874

0 commit comments

Comments
 (0)