Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a054e1a1
Commit
a054e1a1
authored
May 09, 2003
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a note about accessing user-defined functions with an import statement
in the setup parameter
parent
8b54a29c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
Doc/lib/libtimeit.tex
Doc/lib/libtimeit.tex
+17
-0
No files found.
Doc/lib/libtimeit.tex
View file @
a054e1a1
...
...
@@ -193,3 +193,20 @@ missing and present object attributes.
>>> print "
%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000)
3.15 usec/pass
\end{verbatim}
To give the
\module
{
timeit
}
module access to functions you
define, you can pass a
\code
{
setup
}
parameter which contains an import
statement:
\begin{verbatim}
def test():
"Stupid test function"
L = []
for i in range(100):
L.append(i)
if
__
name
__
=='
__
main
__
':
from timeit import Timer
t = Timer("test()", "from
__
main
__
import test")
print t.timeit()
\end{verbatim}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment