mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #18518: timeit now rejects statements which can't be compiled outside
a function or a loop (e.g. "return" or "break").
This commit is contained in:
parent
21d7533c4c
commit
2bef58577f
4 changed files with 21 additions and 6 deletions
|
@ -64,12 +64,6 @@ 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=<default timer>, repeat=3, number=1000000)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue