From 44da19a63d332a11df16475744355e091c89f3b8 Mon Sep 17 00:00:00 2001 From: Andrew Kuchling Date: Mon, 14 Apr 2014 13:39:43 -0400 Subject: #18518: mention that including a return statement changes/breaks the behaviour --- Doc/library/timeit.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index 0cc1586..824a8a3 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -63,6 +63,12 @@ The module defines three convenience functions and a public class: Create a :class:`Timer` instance with the given statement, *setup* code and *timer* function and run its :meth:`.timeit` method with *number* executions. + .. note:: + + Because :meth:`.timeit` is executing *stmt*, placing a return statement + in *stmt* will prevent :meth:`.timeit` from returning execution time. + It will instead return the data specified by your return statement. + .. function:: repeat(stmt='pass', setup='pass', timer=, repeat=3, number=1000000) -- cgit v0.12