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
dd42edcc
Commit
dd42edcc
authored
Mar 21, 2003
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename variables _seq to _it and seq to it, to emphasize that this is
an iterator (which can only be used once!).
parent
6fa2dc70
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Lib/timeit.py
Lib/timeit.py
+5
-5
No files found.
Lib/timeit.py
View file @
dd42edcc
...
...
@@ -75,10 +75,10 @@ else:
# in Timer.__init__() depend on setup being indented 4 spaces and stmt
# being indented 8 spaces.
template
=
"""
def inner(_
seq
, _timer):
def inner(_
it
, _timer):
%(setup)s
_t0 = _timer()
for _i in _
seq
:
for _i in _
it
:
%(stmt)s
_t1 = _timer()
return _t1 - _t0
...
...
@@ -151,10 +151,10 @@ class Timer:
the timer function to be used are passed to the constructor.
"""
if
itertools
:
seq
=
itertools
.
repeat
(
None
,
number
)
it
=
itertools
.
repeat
(
None
,
number
)
else
:
seq
=
[
None
]
*
number
return
self
.
inner
(
seq
,
self
.
timer
)
it
=
[
None
]
*
number
return
self
.
inner
(
it
,
self
.
timer
)
def
repeat
(
self
,
repeat
=
default_repeat
,
number
=
default_number
):
"""Call timer() a few times.
...
...
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